From 7b3e656c2acfcd495cc006f7d69b9d8e5277f4dd Mon Sep 17 00:00:00 2001
From: ferrari <maxence.ferrari@gmail.com>
Date: Wed, 9 Feb 2022 11:11:12 +0100
Subject: [PATCH] Add smart method

---
 README.md             |     6 +-
 c_corr.c              | 17142 ++++++++++++++++++++++++++++++++--------
 c_corr.pyx            |    79 +-
 cython_setup.py       |     2 +-
 gsrp_smart_util.py    |   143 +
 gsrp_tdoa_hyperres.py |    30 +-
 6 files changed, 14216 insertions(+), 3186 deletions(-)
 mode change 100755 => 100644 c_corr.c
 create mode 100644 gsrp_smart_util.py

diff --git a/README.md b/README.md
index 9ee0488..860be2d 100644
--- a/README.md
+++ b/README.md
@@ -76,7 +76,7 @@ Other:
   -e, --erase           Erase existing outfile. If outfile exist and --erase
                         is not provide, the script will exit.
   -n, --no-hyperres     Disable the hyper resolution evalutation of the TDOA
-  -M {estimate,auto,on-the-fly,prepare}, --mode {estimate,auto,on-the-fly,prepare}
+  -M {smart,auto,on-the-fly,prepare}, --mode {smart,auto,on-the-fly,prepare}
                         How to explore the TDOA space (default: prepare).
                         'prepare' precomputes all the possible TDOA
                         pairs and then evaluate them. All the results are save
@@ -84,8 +84,8 @@ Other:
                         'on-the-fly' compute the TDOA pairs at the same
                         time as it compute the loss function. Only the maximum
                         is saved. Can be slower than 'prepare'.
-                        'estimate' try to reduce the number of TDOA to
-                        evaluate.
+                        'smart' gradually increase the search space dimension, '
+                        reducing the number of tdoa to evaluate.
                         'auto' automatically try to pick the right
                         method.
 
diff --git a/c_corr.c b/c_corr.c
old mode 100755
new mode 100644
index 59e6006..5a4de33
--- a/c_corr.c
+++ b/c_corr.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.29.15 */
+/* Generated by Cython 0.29.24 */
 
 /* BEGIN: Cython Metadata
 {
@@ -12,16 +12,18 @@
 }
 END: Cython Metadata */
 
+#ifndef PY_SSIZE_T_CLEAN
 #define PY_SSIZE_T_CLEAN
+#endif /* PY_SSIZE_T_CLEAN */
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
     #error Cython requires Python 2.6+ or Python 3.3+.
 #else
-#define CYTHON_ABI "0_29_15"
-#define CYTHON_HEX_VERSION 0x001D0FF0
-#define CYTHON_FUTURE_DIVISION 0
+#define CYTHON_ABI "0_29_24"
+#define CYTHON_HEX_VERSION 0x001D18F0
+#define CYTHON_FUTURE_DIVISION 1
 #include <stddef.h>
 #ifndef offsetof
   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
@@ -438,8 +440,12 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
 #endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
+  #if defined(PyUnicode_IS_READY)
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                               0 : _PyUnicode_Ready((PyObject *)(op)))
+  #else
+  #define __Pyx_PyUnicode_READY(op)       (0)
+  #endif
   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
@@ -447,7 +453,15 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
+  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
+  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
+  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
+  #else
   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
+  #endif
+  #else
+  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
+  #endif
 #else
   #define CYTHON_PEP393_ENABLED 0
   #define PyUnicode_1BYTE_KIND  1
@@ -496,8 +510,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
   #define PyString_Type                PyUnicode_Type
   #define PyString_Check               PyUnicode_Check
   #define PyString_CheckExact          PyUnicode_CheckExact
+#ifndef PyObject_Unicode
   #define PyObject_Unicode             PyObject_Str
 #endif
+#endif
 #if PY_MAJOR_VERSION >= 3
   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
@@ -508,6 +524,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
 #ifndef PySet_CheckExact
   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
+#if PY_VERSION_HEX >= 0x030900A4
+  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
+  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
+#else
+  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
+  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
+#endif
 #if CYTHON_ASSUME_SAFE_MACROS
   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
 #else
@@ -547,7 +570,7 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
 #endif
 #if PY_MAJOR_VERSION >= 3
-  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
+  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
 #else
   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
 #endif
@@ -588,11 +611,10 @@ static CYTHON_INLINE float __PYX_NAN() {
 #define __Pyx_truncl truncl
 #endif
 
-
+#define __PYX_MARK_ERR_POS(f_index, lineno) \
+    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
 #define __PYX_ERR(f_index, lineno, Ln_error) \
-{ \
-  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
-}
+    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
 
 #ifndef __PYX_EXTERN_C
   #ifdef __cplusplus
@@ -1352,7 +1374,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
         Py_INCREF(x);
         PyList_SET_ITEM(list, len, x);
-        Py_SIZE(list) = len+1;
+        __Pyx_SET_SIZE(list, len + 1);
         return 0;
     }
     return PyList_Append(list, x);
@@ -1434,6 +1456,232 @@ static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
 
+/* Profile.proto */
+#ifndef CYTHON_PROFILE
+#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
+  #define CYTHON_PROFILE 0
+#else
+  #define CYTHON_PROFILE 1
+#endif
+#endif
+#ifndef CYTHON_TRACE_NOGIL
+  #define CYTHON_TRACE_NOGIL 0
+#else
+  #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
+    #define CYTHON_TRACE 1
+  #endif
+#endif
+#ifndef CYTHON_TRACE
+  #define CYTHON_TRACE 0
+#endif
+#if CYTHON_TRACE
+  #undef CYTHON_PROFILE_REUSE_FRAME
+#endif
+#ifndef CYTHON_PROFILE_REUSE_FRAME
+  #define CYTHON_PROFILE_REUSE_FRAME 0
+#endif
+#if CYTHON_PROFILE || CYTHON_TRACE
+  #include "compile.h"
+  #include "frameobject.h"
+  #include "traceback.h"
+  #if CYTHON_PROFILE_REUSE_FRAME
+    #define CYTHON_FRAME_MODIFIER static
+    #define CYTHON_FRAME_DEL(frame)
+  #else
+    #define CYTHON_FRAME_MODIFIER
+    #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
+  #endif
+  #define __Pyx_TraceDeclarations\
+      static PyCodeObject *__pyx_frame_code = NULL;\
+      CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
+      int __Pyx_use_tracing = 0;
+  #define __Pyx_TraceFrameInit(codeobj)\
+      if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
+#if PY_VERSION_HEX >= 0x030a00b1
+  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
+     (unlikely((tstate)->cframe->use_tracing) &&\
+         (!(check_tracing) || !(tstate)->tracing) &&\
+         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
+  #define __Pyx_SetTracing(tstate, enable)\
+      (tstate)->cframe->use_tracing = (enable)
+#else
+  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
+     (unlikely((tstate)->use_tracing) &&\
+         (!(check_tracing) || !(tstate)->tracing) &&\
+         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
+  #define __Pyx_SetTracing(tstate, enable)\
+      (tstate)->use_tracing = (enable)
+#endif
+  #ifdef WITH_THREAD
+  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
+  if (nogil) {\
+      if (CYTHON_TRACE_NOGIL) {\
+          PyThreadState *tstate;\
+          PyGILState_STATE state = PyGILState_Ensure();\
+          tstate = __Pyx_PyThreadState_Current;\
+          if (__Pyx_IsTracing(tstate, 1, 1)) {\
+              __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
+          }\
+          PyGILState_Release(state);\
+          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
+      }\
+  } else {\
+      PyThreadState* tstate = PyThreadState_GET();\
+      if (__Pyx_IsTracing(tstate, 1, 1)) {\
+          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
+          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
+      }\
+  }
+  #else
+  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
+  {   PyThreadState* tstate = PyThreadState_GET();\
+      if (__Pyx_IsTracing(tstate, 1, 1)) {\
+          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
+          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
+      }\
+  }
+  #endif
+  #define __Pyx_TraceException()\
+  if (likely(!__Pyx_use_tracing)); else {\
+      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
+      if (__Pyx_IsTracing(tstate, 0, 1)) {\
+          tstate->tracing++;\
+          __Pyx_SetTracing(tstate, 0);\
+          PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
+          if (exc_info) {\
+              if (CYTHON_TRACE && tstate->c_tracefunc)\
+                  tstate->c_tracefunc(\
+                      tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
+              tstate->c_profilefunc(\
+                  tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
+              Py_DECREF(exc_info);\
+          }\
+          __Pyx_SetTracing(tstate, 1);\
+          tstate->tracing--;\
+      }\
+  }
+  static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
+      PyObject *type, *value, *traceback;
+      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
+      tstate->tracing++;
+      __Pyx_SetTracing(tstate, 0);
+      if (CYTHON_TRACE && tstate->c_tracefunc)
+          tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
+      if (tstate->c_profilefunc)
+          tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
+      CYTHON_FRAME_DEL(frame);
+      __Pyx_SetTracing(tstate, 1);
+      tstate->tracing--;
+      __Pyx_ErrRestoreInState(tstate, type, value, traceback);
+  }
+  #ifdef WITH_THREAD
+  #define __Pyx_TraceReturn(result, nogil)\
+  if (likely(!__Pyx_use_tracing)); else {\
+      if (nogil) {\
+          if (CYTHON_TRACE_NOGIL) {\
+              PyThreadState *tstate;\
+              PyGILState_STATE state = PyGILState_Ensure();\
+              tstate = __Pyx_PyThreadState_Current;\
+              if (__Pyx_IsTracing(tstate, 0, 0)) {\
+                  __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
+              }\
+              PyGILState_Release(state);\
+          }\
+      } else {\
+          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
+          if (__Pyx_IsTracing(tstate, 0, 0)) {\
+              __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
+          }\
+      }\
+  }
+  #else
+  #define __Pyx_TraceReturn(result, nogil)\
+  if (likely(!__Pyx_use_tracing)); else {\
+      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
+      if (__Pyx_IsTracing(tstate, 0, 0)) {\
+          __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
+      }\
+  }
+  #endif
+  static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
+  static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
+#else
+  #define __Pyx_TraceDeclarations
+  #define __Pyx_TraceFrameInit(codeobj)
+  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)   if ((1)); else goto_error;
+  #define __Pyx_TraceException()
+  #define __Pyx_TraceReturn(result, nogil)
+#endif
+#if CYTHON_TRACE
+  static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
+      int ret;
+      PyObject *type, *value, *traceback;
+      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
+      __Pyx_PyFrame_SetLineNumber(frame, lineno);
+      tstate->tracing++;
+      __Pyx_SetTracing(tstate, 0);
+      ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
+      __Pyx_SetTracing(tstate, 1);
+      tstate->tracing--;
+      if (likely(!ret)) {
+          __Pyx_ErrRestoreInState(tstate, type, value, traceback);
+      } else {
+          Py_XDECREF(type);
+          Py_XDECREF(value);
+          Py_XDECREF(traceback);
+      }
+      return ret;
+  }
+  #ifdef WITH_THREAD
+  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
+  if (likely(!__Pyx_use_tracing)); else {\
+      if (nogil) {\
+          if (CYTHON_TRACE_NOGIL) {\
+              int ret = 0;\
+              PyThreadState *tstate;\
+              PyGILState_STATE state = PyGILState_Ensure();\
+              tstate = __Pyx_PyThreadState_Current;\
+              if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
+                  ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
+              }\
+              PyGILState_Release(state);\
+              if (unlikely(ret)) goto_error;\
+          }\
+      } else {\
+          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
+          if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
+              int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
+              if (unlikely(ret)) goto_error;\
+          }\
+      }\
+  }
+  #else
+  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
+  if (likely(!__Pyx_use_tracing)); else {\
+      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
+      if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
+          int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
+          if (unlikely(ret)) goto_error;\
+      }\
+  }
+  #endif
+#else
+  #define __Pyx_TraceLine(lineno, nogil, goto_error)   if ((1)); else goto_error;
+#endif
+
+/* WriteUnraisableException.proto */
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename,
+                                  int full_traceback, int nogil);
+
+/* PyIntBinop.proto */
+#if !CYTHON_COMPILING_IN_PYPY
+static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
+#else
+#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
+    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
+#endif
+
 /* ArgTypeTest.proto */
 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
@@ -1566,7 +1814,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     if (likely(L->allocated > len)) {
         Py_INCREF(x);
         PyList_SET_ITEM(list, len, x);
-        Py_SIZE(list) = len+1;
+        __Pyx_SET_SIZE(list, len + 1);
         return 0;
     }
     return PyList_Append(list, x);
@@ -1625,13 +1873,16 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam
 /* SetVTable.proto */
 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
 
+/* PyObjectGetAttrStrNoError.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
+
 /* SetupReduce.proto */
 static int __Pyx_setup_reduce(PyObject* type_obj);
 
 /* FetchCommonType.proto */
 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
 
-/* CythonFunction.proto */
+/* CythonFunctionShared.proto */
 #define __Pyx_CyFunction_USED 1
 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
@@ -1659,6 +1910,7 @@ typedef struct {
     PyObject *func_classobj;
     void *defaults;
     int defaults_pyobjects;
+    size_t defaults_size;  // used by FusedFunction for copying defaults
     int flags;
     PyObject *defaults_tuple;
     PyObject *defaults_kwdict;
@@ -1667,9 +1919,7 @@ typedef struct {
 } __pyx_CyFunctionObject;
 static PyTypeObject *__pyx_CyFunctionType = 0;
 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
-#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
-    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
-static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
+static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                       int flags, PyObject* qualname,
                                       PyObject *self,
                                       PyObject *module, PyObject *globals,
@@ -1692,11 +1942,8 @@ typedef struct {
     PyObject *type;
     PyObject *self;
 } __pyx_FusedFunctionObject;
-#define __pyx_FusedFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
-        __pyx_FusedFunction_New(__pyx_FusedFunctionType, ml, flags, qualname, self, module, globals, code)
-static PyObject *__pyx_FusedFunction_New(PyTypeObject *type,
-                                         PyMethodDef *ml, int flags,
-                                         PyObject *qualname, PyObject *self,
+static PyObject *__pyx_FusedFunction_New(PyMethodDef *ml, int flags,
+                                         PyObject *qualname, PyObject *closure,
                                          PyObject *module, PyObject *globals,
                                          PyObject *code);
 static int __pyx_FusedFunction_clear(__pyx_FusedFunctionObject *self);
@@ -1796,9 +2043,6 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_i
 /* ObjectToMemviewSlice.proto */
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(PyObject *, int writable_flag);
 
-/* ObjectToMemviewSlice.proto */
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_PY_LONG_LONG(PyObject *, int writable_flag);
-
 /* ObjectToMemviewSlice.proto */
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *, int writable_flag);
 
@@ -1815,13 +2059,30 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__i
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__long(PyObject *, int writable_flag);
 
 /* ObjectToMemviewSlice.proto */
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(PyObject *, int writable_flag);
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_short(PyObject *, int writable_flag);
 
-/* CIntToPy.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+/* ObjectToMemviewSlice.proto */
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int(PyObject *, int writable_flag);
 
-/* CIntToPy.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+/* ObjectToMemviewSlice.proto */
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_long(PyObject *, int writable_flag);
+
+/* GCCDiagnostics.proto */
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+#define __Pyx_HAS_GCC_DIAGNOSTIC
+#endif
+
+/* MemviewDtypeToObject.proto */
+static CYTHON_INLINE PyObject *__pyx_memview_get_long(const char *itemp);
+static CYTHON_INLINE int __pyx_memview_set_long(const char *itemp, PyObject *obj);
+
+/* MemviewDtypeToObject.proto */
+static CYTHON_INLINE PyObject *__pyx_memview_get_short(const char *itemp);
+static CYTHON_INLINE int __pyx_memview_set_short(const char *itemp, PyObject *obj);
+
+/* MemviewDtypeToObject.proto */
+static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp);
+static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj);
 
 /* MemviewSliceCopyTemplate.proto */
 static __Pyx_memviewslice
@@ -1830,12 +2091,8 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                  size_t sizeof_dtype, int contig_flag,
                                  int dtype_is_object);
 
-/* BytesContains.proto */
-static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character);
-
-/* ImportNumPyArray.proto */
-static PyObject *__pyx_numpy_ndarray = NULL;
-static PyObject* __Pyx_ImportNumPyArrayTypeIfAvailable(void);
+/* CIntFromPy.proto */
+static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *);
 
 /* CIntFromPy.proto */
 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
@@ -1843,6 +2100,22 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
 /* CIntFromPy.proto */
 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
 
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);
+
+/* BytesContains.proto */
+static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character);
+
+/* ImportNumPyArray.proto */
+static PyObject *__pyx_numpy_ndarray = NULL;
+static PyObject* __Pyx_ImportNumPyArrayTypeIfAvailable(void);
+
 /* CIntFromPy.proto */
 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
 
@@ -1879,6 +2152,11 @@ static PyObject *contiguous = 0;
 static PyObject *indirect_contiguous = 0;
 static int __pyx_memoryview_thread_locks_used;
 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
+static long __pyx_f_6c_corr_moduloNeg(long, long); /*proto*/
+static double __pyx_f_6c_corr__c_corr_core(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, double, long, long, long, long, long); /*proto*/
+static PyObject *__pyx_fuse_0__pyx_f_6c_corr_c_corr_all(PyObject *, short, short, int __pyx_skip_dispatch); /*proto*/
+static PyObject *__pyx_fuse_1__pyx_f_6c_corr_c_corr_all(PyObject *, int, int, int __pyx_skip_dispatch); /*proto*/
+static PyObject *__pyx_fuse_2__pyx_f_6c_corr_c_corr_all(PyObject *, long, long, int __pyx_skip_dispatch); /*proto*/
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
@@ -1915,7 +2193,6 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *,
 static __Pyx_TypeInfo __Pyx_TypeInfo_short = { "short", NULL, sizeof(short), { 0 }, 0, IS_UNSIGNED(short) ? 'U' : 'I', IS_UNSIGNED(short), 0 };
 static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
 static __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), { 0 }, 0, IS_UNSIGNED(long) ? 'U' : 'I', IS_UNSIGNED(long), 0 };
-static __Pyx_TypeInfo __Pyx_TypeInfo_PY_LONG_LONG = { "long long", NULL, sizeof(PY_LONG_LONG), { 0 }, 0, IS_UNSIGNED(PY_LONG_LONG) ? 'U' : 'I', IS_UNSIGNED(PY_LONG_LONG), 0 };
 static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
 static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
 #define __Pyx_MODULE_NAME "c_corr"
@@ -1925,6 +2202,8 @@ int __pyx_module_is_main_c_corr = 0;
 /* Implementation of 'c_corr' */
 static PyObject *__pyx_builtin_TypeError;
 static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_min;
+static PyObject *__pyx_builtin_max;
 static PyObject *__pyx_builtin_ValueError;
 static PyObject *__pyx_builtin_MemoryError;
 static PyObject *__pyx_builtin_enumerate;
@@ -1939,11 +2218,16 @@ static const char __pyx_k_p[] = "p";
 static const char __pyx_k_s[] = "s";
 static const char __pyx_k__2[] = "|";
 static const char __pyx_k_cc[] = "cc";
+static const char __pyx_k_i0[] = "i0";
 static const char __pyx_k_id[] = "id";
+static const char __pyx_k_j0[] = "j0";
 static const char __pyx_k_np[] = "np";
 static const char __pyx_k_int[] = "int";
+static const char __pyx_k_max[] = "max";
+static const char __pyx_k_min[] = "min";
 static const char __pyx_k_new[] = "__new__";
 static const char __pyx_k_obj[] = "obj";
+static const char __pyx_k_val[] = "val";
 static const char __pyx_k_args[] = "args";
 static const char __pyx_k_base[] = "base";
 static const char __pyx_k_dict[] = "__dict__";
@@ -1966,6 +2250,7 @@ static const char __pyx_k_error[] = "error";
 static const char __pyx_k_flags[] = "flags";
 static const char __pyx_k_float[] = "float";
 static const char __pyx_k_index[] = "index";
+static const char __pyx_k_level[] = "level";
 static const char __pyx_k_log10[] = "log10";
 static const char __pyx_k_numpy[] = "numpy";
 static const char __pyx_k_range[] = "range";
@@ -1975,6 +2260,8 @@ static const char __pyx_k_split[] = "split";
 static const char __pyx_k_start[] = "start";
 static const char __pyx_k_strip[] = "strip";
 static const char __pyx_k_total[] = "total";
+static const char __pyx_k_zeros[] = "zeros";
+static const char __pyx_k_astype[] = "astype";
 static const char __pyx_k_c_corr[] = "c_corr";
 static const char __pyx_k_double[] = "double";
 static const char __pyx_k_encode[] = "encode";
@@ -1988,28 +2275,38 @@ static const char __pyx_k_reduce[] = "__reduce__";
 static const char __pyx_k_struct[] = "struct";
 static const char __pyx_k_unpack[] = "unpack";
 static const char __pyx_k_update[] = "update";
+static const char __pyx_k_float32[] = "float32";
 static const char __pyx_k_fortran[] = "fortran";
 static const char __pyx_k_int_int[] = "int|int";
 static const char __pyx_k_memview[] = "memview";
+static const char __pyx_k_tmp_val[] = "tmp_val";
 static const char __pyx_k_Ellipsis[] = "Ellipsis";
 static const char __pyx_k_corr_val[] = "corr_val";
 static const char __pyx_k_defaults[] = "defaults";
 static const char __pyx_k_getstate[] = "__getstate__";
+static const char __pyx_k_ind_tdoa[] = "ind_tdoa";
 static const char __pyx_k_int_long[] = "int|long";
 static const char __pyx_k_itemsize[] = "itemsize";
 static const char __pyx_k_long_int[] = "long|int";
+static const char __pyx_k_max_tdoa[] = "max_tdoa";
+static const char __pyx_k_out_taus[] = "out_taus";
 static const char __pyx_k_pyx_type[] = "__pyx_type";
 static const char __pyx_k_setstate[] = "__setstate__";
+static const char __pyx_k_win_size[] = "win_size";
 static const char __pyx_k_TypeError[] = "TypeError";
+static const char __pyx_k_base_tdoa[] = "base_tdoa";
+static const char __pyx_k_c_corr_at[] = "c_corr_at";
+static const char __pyx_k_curr_tdoa[] = "curr_tdoa";
 static const char __pyx_k_enumerate[] = "enumerate";
 static const char __pyx_k_float_int[] = "float|int";
 static const char __pyx_k_int_short[] = "int|short";
-static const char __pyx_k_long_long[] = "long long";
+static const char __pyx_k_long_long[] = "long|long";
 static const char __pyx_k_pyx_state[] = "__pyx_state";
 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
 static const char __pyx_k_short_int[] = "short|int";
 static const char __pyx_k_IndexError[] = "IndexError";
 static const char __pyx_k_ValueError[] = "ValueError";
+static const char __pyx_k_c_corr_all[] = "c_corr_all";
 static const char __pyx_k_c_corr_pyx[] = "c_corr.pyx";
 static const char __pyx_k_double_int[] = "double|int";
 static const char __pyx_k_float_long[] = "float|long";
@@ -2022,31 +2319,25 @@ static const char __pyx_k_MemoryError[] = "MemoryError";
 static const char __pyx_k_PickleError[] = "PickleError";
 static const char __pyx_k_double_long[] = "double|long";
 static const char __pyx_k_float_short[] = "float|short";
-static const char __pyx_k_long_long_2[] = "long|long";
 static const char __pyx_k_short_short[] = "short|short";
+static const char __pyx_k_c_corr_core2[] = "_c_corr_core2";
 static const char __pyx_k_double_short[] = "double|short";
 static const char __pyx_k_max_corr_val[] = "max_corr_val";
 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
 static const char __pyx_k_stringsource[] = "stringsource";
-static const char __pyx_k_int_long_long[] = "int|long long";
-static const char __pyx_k_long_long_int[] = "long long|int";
 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
-static const char __pyx_k_long_long_long[] = "long|long long";
 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
-static const char __pyx_k_float_long_long[] = "float|long long";
-static const char __pyx_k_long_long_short[] = "long long|short";
 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
-static const char __pyx_k_short_long_long[] = "short|long long";
-static const char __pyx_k_double_long_long[] = "double|long long";
-static const char __pyx_k_long_long_long_2[] = "long long|long";
 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
-static const char __pyx_k_long_long_long_long[] = "long long|long long";
+static const char __pyx_k_pyx_fuse_0c_corr_all[] = "__pyx_fuse_0c_corr_all";
+static const char __pyx_k_pyx_fuse_1c_corr_all[] = "__pyx_fuse_1c_corr_all";
+static const char __pyx_k_pyx_fuse_2c_corr_all[] = "__pyx_fuse_2c_corr_all";
 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
@@ -2103,10 +2394,15 @@ static PyObject *__pyx_n_s_View_MemoryView;
 static PyObject *__pyx_kp_s__2;
 static PyObject *__pyx_n_s_allocate_buffer;
 static PyObject *__pyx_n_s_args;
+static PyObject *__pyx_n_s_astype;
 static PyObject *__pyx_n_s_base;
+static PyObject *__pyx_n_s_base_tdoa;
 static PyObject *__pyx_n_s_c;
 static PyObject *__pyx_n_u_c;
 static PyObject *__pyx_n_s_c_corr;
+static PyObject *__pyx_n_s_c_corr_all;
+static PyObject *__pyx_n_s_c_corr_at;
+static PyObject *__pyx_n_s_c_corr_core2;
 static PyObject *__pyx_kp_s_c_corr_pyx;
 static PyObject *__pyx_n_s_cc;
 static PyObject *__pyx_n_s_class;
@@ -2114,12 +2410,12 @@ static PyObject *__pyx_n_s_cline_in_traceback;
 static PyObject *__pyx_kp_s_contiguous_and_direct;
 static PyObject *__pyx_kp_s_contiguous_and_indirect;
 static PyObject *__pyx_n_s_corr_val;
+static PyObject *__pyx_n_s_curr_tdoa;
 static PyObject *__pyx_n_s_defaults;
 static PyObject *__pyx_n_s_dict;
 static PyObject *__pyx_n_s_double;
 static PyObject *__pyx_kp_s_double_int;
 static PyObject *__pyx_kp_s_double_long;
-static PyObject *__pyx_kp_s_double_long_long;
 static PyObject *__pyx_kp_s_double_short;
 static PyObject *__pyx_n_s_dtype;
 static PyObject *__pyx_n_s_dtype_is_object;
@@ -2128,9 +2424,9 @@ static PyObject *__pyx_n_s_enumerate;
 static PyObject *__pyx_n_s_error;
 static PyObject *__pyx_n_s_flags;
 static PyObject *__pyx_n_s_float;
+static PyObject *__pyx_n_s_float32;
 static PyObject *__pyx_kp_s_float_int;
 static PyObject *__pyx_kp_s_float_long;
-static PyObject *__pyx_kp_s_float_long_long;
 static PyObject *__pyx_kp_s_float_short;
 static PyObject *__pyx_n_s_format;
 static PyObject *__pyx_n_s_fortran;
@@ -2138,32 +2434,32 @@ static PyObject *__pyx_n_u_fortran;
 static PyObject *__pyx_n_s_getstate;
 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
 static PyObject *__pyx_n_s_i;
+static PyObject *__pyx_n_s_i0;
 static PyObject *__pyx_n_s_id;
 static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_ind_tdoa;
 static PyObject *__pyx_n_s_index;
 static PyObject *__pyx_n_s_int;
 static PyObject *__pyx_kp_s_int_int;
 static PyObject *__pyx_kp_s_int_long;
-static PyObject *__pyx_kp_s_int_long_long;
 static PyObject *__pyx_kp_s_int_short;
 static PyObject *__pyx_n_s_itemsize;
 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
+static PyObject *__pyx_n_s_j0;
 static PyObject *__pyx_n_s_kind;
 static PyObject *__pyx_n_s_kwargs;
+static PyObject *__pyx_n_s_level;
 static PyObject *__pyx_n_s_log10;
 static PyObject *__pyx_n_s_long;
 static PyObject *__pyx_kp_s_long_int;
 static PyObject *__pyx_kp_s_long_long;
-static PyObject *__pyx_kp_s_long_long_2;
-static PyObject *__pyx_kp_s_long_long_int;
-static PyObject *__pyx_kp_s_long_long_long;
-static PyObject *__pyx_kp_s_long_long_long_2;
-static PyObject *__pyx_kp_s_long_long_long_long;
-static PyObject *__pyx_kp_s_long_long_short;
 static PyObject *__pyx_kp_s_long_short;
 static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_max;
 static PyObject *__pyx_n_s_max_corr_val;
+static PyObject *__pyx_n_s_max_tdoa;
 static PyObject *__pyx_n_s_memview;
+static PyObject *__pyx_n_s_min;
 static PyObject *__pyx_n_s_mode;
 static PyObject *__pyx_n_s_n_pair;
 static PyObject *__pyx_n_s_name;
@@ -2174,11 +2470,15 @@ static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
 static PyObject *__pyx_n_s_np;
 static PyObject *__pyx_n_s_numpy;
 static PyObject *__pyx_n_s_obj;
+static PyObject *__pyx_n_s_out_taus;
 static PyObject *__pyx_n_s_p;
 static PyObject *__pyx_n_s_pack;
 static PyObject *__pyx_n_s_pickle;
 static PyObject *__pyx_n_s_pyx_PickleError;
 static PyObject *__pyx_n_s_pyx_checksum;
+static PyObject *__pyx_n_s_pyx_fuse_0c_corr_all;
+static PyObject *__pyx_n_s_pyx_fuse_1c_corr_all;
+static PyObject *__pyx_n_s_pyx_fuse_2c_corr_all;
 static PyObject *__pyx_n_s_pyx_getbuffer;
 static PyObject *__pyx_n_s_pyx_result;
 static PyObject *__pyx_n_s_pyx_state;
@@ -2196,7 +2496,6 @@ static PyObject *__pyx_n_s_shape;
 static PyObject *__pyx_n_s_short;
 static PyObject *__pyx_kp_s_short_int;
 static PyObject *__pyx_kp_s_short_long;
-static PyObject *__pyx_kp_s_short_long_long;
 static PyObject *__pyx_kp_s_short_short;
 static PyObject *__pyx_n_s_signatures;
 static PyObject *__pyx_n_s_size;
@@ -2212,36 +2511,51 @@ static PyObject *__pyx_n_s_strip;
 static PyObject *__pyx_n_s_struct;
 static PyObject *__pyx_n_s_taus;
 static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_tmp_val;
 static PyObject *__pyx_n_s_total;
 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
 static PyObject *__pyx_n_s_unpack;
 static PyObject *__pyx_n_s_update;
-static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
-static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_32c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_34c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_36c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_38c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_40c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_42c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_44c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_46c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
-static PyObject *__pyx_pf_6c_corr_48c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_n_s_val;
+static PyObject *__pyx_n_s_win_size;
+static PyObject *__pyx_n_s_zeros;
+static PyObject *__pyx_pf_6c_corr_c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
+static PyObject *__pyx_pf_6c_corr_6c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_8c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_10c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_12c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_14c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_16c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_18c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_20c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_22c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_24c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_26c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_28c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_30c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_32c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_34c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus); /* proto */
+static PyObject *__pyx_pf_6c_corr_2c_corr_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
+static PyObject *__pyx_pf_6c_corr_38__pyx_fuse_0c_corr_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cc, short __pyx_v_max_tdoa, short __pyx_v_base_tdoa); /* proto */
+static PyObject *__pyx_pf_6c_corr_40__pyx_fuse_1c_corr_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cc, int __pyx_v_max_tdoa, int __pyx_v_base_tdoa); /* proto */
+static PyObject *__pyx_pf_6c_corr_42__pyx_fuse_2c_corr_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cc, long __pyx_v_max_tdoa, long __pyx_v_base_tdoa); /* proto */
+static PyObject *__pyx_pf_6c_corr_4_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
+static PyObject *__pyx_pf_6c_corr_46_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_48_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_50_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_52_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_54_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_56_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_58_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_60_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_62_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_64_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_66_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_68_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_70_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_72_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair); /* proto */
+static PyObject *__pyx_pf_6c_corr_74_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair); /* proto */
 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
@@ -2291,6 +2605,8 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO
 static PyObject *__pyx_int_0;
 static PyObject *__pyx_int_1;
 static PyObject *__pyx_int_2;
+static PyObject *__pyx_int_3;
+static PyObject *__pyx_int_9;
 static PyObject *__pyx_int_184977713;
 static PyObject *__pyx_int_neg_1;
 static PyObject *__pyx_tuple__3;
@@ -2315,31 +2631,39 @@ static PyObject *__pyx_tuple__21;
 static PyObject *__pyx_tuple__22;
 static PyObject *__pyx_tuple__23;
 static PyObject *__pyx_tuple__25;
-static PyObject *__pyx_tuple__26;
 static PyObject *__pyx_tuple__27;
-static PyObject *__pyx_tuple__28;
 static PyObject *__pyx_tuple__29;
 static PyObject *__pyx_tuple__30;
+static PyObject *__pyx_tuple__31;
+static PyObject *__pyx_tuple__32;
+static PyObject *__pyx_tuple__33;
+static PyObject *__pyx_tuple__34;
 static PyObject *__pyx_codeobj__24;
-static PyObject *__pyx_codeobj__31;
+static PyObject *__pyx_codeobj__26;
+static PyObject *__pyx_codeobj__28;
+static PyObject *__pyx_codeobj__35;
 /* Late includes */
 
-/* "c_corr.pyx":23
- * @cython.boundscheck(False)
+/* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6c_corr_1c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_6c_corr_1c_corr = {"c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6c_corr_1c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_pw_6c_corr_1c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_6c_corr_1c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6c_corr_c_corr_at[] = "c_corr_at(signatures, args, kwargs, defaults)";
+static PyMethodDef __pyx_mdef_6c_corr_1c_corr_at = {"c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6c_corr_1c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_pw_6c_corr_1c_corr_at(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;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
@@ -2370,23 +2694,23 @@ static PyObject *__pyx_pw_6c_corr_1c_corr(PyObject *__pyx_self, PyObject *__pyx_
         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, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(0, 22, __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, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(0, 22, __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, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(0, 22, __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, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
       goto __pyx_L5_argtuple_error;
@@ -2403,20 +2727,20 @@ static PyObject *__pyx_pw_6c_corr_1c_corr(PyObject *__pyx_self, PyObject *__pyx_
   }
   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, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
   __Pyx_AddTraceback("c_corr.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_c_corr(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
+  __pyx_r = __pyx_pf_6c_corr_c_corr_at(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) {
+static PyObject *__pyx_pf_6c_corr_c_corr_at(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;
@@ -2427,7 +2751,6 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
   int __pyx_v_short_is_signed;
   int __pyx_v_int_is_signed;
   int __pyx_v_long_is_signed;
-  int __pyx_v_long_long_is_signed;
   PyObject *__pyx_v_arg = NULL;
   PyObject *__pyx_v_dtype = NULL;
   PyObject *__pyx_v_arg_base = NULL;
@@ -2456,9 +2779,12 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
   Py_ssize_t __pyx_t_16;
   Py_ssize_t __pyx_t_17;
   int __pyx_t_18;
-  __Pyx_RefNannySetupContext("c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("c_corr_at", 0);
   __Pyx_INCREF(__pyx_v_kwargs);
-  __pyx_t_1 = PyList_New(1 * 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_1 = PyList_New(1 * 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_1);
   { Py_ssize_t __pyx_temp;
     for (__pyx_temp=0; __pyx_temp < 2; __pyx_temp++) {
@@ -2476,7 +2802,7 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     __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, 23, __pyx_L1_error)
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
   __pyx_t_3 = ((!__pyx_t_4) != 0);
   __pyx_t_2 = __pyx_t_3;
   __pyx_L4_bool_binop_done:;
@@ -2484,7 +2810,7 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     __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, 23, __pyx_L1_error)
+  __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -2492,17 +2818,16 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
   __pyx_v_short_is_signed = (!((((short)-1L) > 0) != 0));
   __pyx_v_int_is_signed = (!((((int)-1L) > 0) != 0));
   __pyx_v_long_is_signed = (!((((long)-1L) > 0) != 0));
-  __pyx_v_long_long_is_signed = (!((((PY_LONG_LONG)-1L) > 0) != 0));
   if (unlikely(__pyx_v_args == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
-    __PYX_ERR(0, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __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, 23, __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, 22, __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, 23, __pyx_L1_error)
+      __PYX_ERR(0, 22, __pyx_L1_error)
     }
     __pyx_t_1 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 0);
     __Pyx_INCREF(__pyx_t_1);
@@ -2519,18 +2844,18 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
   }
   if (unlikely(__pyx_v_kwargs == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
-    __PYX_ERR(0, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __pyx_L1_error)
   }
-  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_cc, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_cc, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+      __PYX_ERR(0, 22, __pyx_L1_error)
     }
-    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_cc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_cc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_v_arg = __pyx_t_1;
     __pyx_t_1 = 0;
@@ -2539,12 +2864,12 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
   /*else*/ {
     if (unlikely(__pyx_v_args == Py_None)) {
       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
-      __PYX_ERR(0, 23, __pyx_L1_error)
+      __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
-    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __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, 22, __pyx_L1_error)
+    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_int_2);
     __Pyx_GIVEREF(__pyx_int_2);
@@ -2555,15 +2880,15 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     __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, 23, __pyx_L1_error)
+    __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, 22, __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, 23, __pyx_L1_error)
+    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __pyx_L1_error)
   }
   __pyx_L6:;
   while (1) {
@@ -2573,7 +2898,7 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
       __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, 23, __pyx_L1_error)
+        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_v_dtype = __pyx_t_6;
         __pyx_t_6 = 0;
@@ -2582,14 +2907,14 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
       __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, 23, __pyx_L1_error)
+        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_GOTREF(__pyx_t_6);
           __pyx_v_dtype = __pyx_t_6;
           __pyx_t_6 = 0;
@@ -2611,14 +2936,14 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
       __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, 23, __pyx_L1_error)
+        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+        __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+        __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 22, __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');
@@ -2631,9 +2956,9 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
             __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, 23, __pyx_L1_error)
+          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
           if (__pyx_t_2) {
@@ -2645,7 +2970,7 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
           __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_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
             goto __pyx_L10_break;
           }
           __pyx_t_2 = (((sizeof(int)) == __pyx_v_itemsize) != 0);
@@ -2654,9 +2979,9 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
             __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, 23, __pyx_L1_error)
+          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
           if (__pyx_t_2) {
@@ -2668,7 +2993,7 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
           __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_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
             goto __pyx_L10_break;
           }
           __pyx_t_2 = (((sizeof(long)) == __pyx_v_itemsize) != 0);
@@ -2677,9 +3002,9 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
             __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, 23, __pyx_L1_error)
+          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
           if (__pyx_t_2) {
@@ -2691,30 +3016,7 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
           __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_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-            goto __pyx_L10_break;
-          }
-          __pyx_t_2 = (((sizeof(PY_LONG_LONG)) == __pyx_v_itemsize) != 0);
-          if (__pyx_t_2) {
-          } else {
-            __pyx_t_3 = __pyx_t_2;
-            goto __pyx_L28_bool_binop_done;
-          }
-          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __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, 23, __pyx_L1_error)
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
-          if (__pyx_t_2) {
-          } else {
-            __pyx_t_3 = __pyx_t_2;
-            goto __pyx_L28_bool_binop_done;
-          }
-          __pyx_t_2 = ((!((__pyx_v_long_long_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0);
-          __pyx_t_3 = __pyx_t_2;
-          __pyx_L28_bool_binop_done:;
-          if (__pyx_t_3) {
-            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_kp_s_long_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
             goto __pyx_L10_break;
           }
           break;
@@ -2723,34 +3025,34 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
           if (__pyx_t_2) {
           } else {
             __pyx_t_3 = __pyx_t_2;
-            goto __pyx_L32_bool_binop_done;
+            goto __pyx_L28_bool_binop_done;
           }
-          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
           __pyx_t_3 = __pyx_t_2;
-          __pyx_L32_bool_binop_done:;
+          __pyx_L28_bool_binop_done:;
           if (__pyx_t_3) {
-            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
             goto __pyx_L10_break;
           }
           __pyx_t_2 = (((sizeof(double)) == __pyx_v_itemsize) != 0);
           if (__pyx_t_2) {
           } else {
             __pyx_t_3 = __pyx_t_2;
-            goto __pyx_L35_bool_binop_done;
+            goto __pyx_L31_bool_binop_done;
           }
-          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
           __pyx_t_3 = __pyx_t_2;
-          __pyx_L35_bool_binop_done:;
+          __pyx_L31_bool_binop_done:;
           if (__pyx_t_3) {
-            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
             goto __pyx_L10_break;
           }
           break;
@@ -2766,18 +3068,18 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     if (!__pyx_t_2) {
     } else {
       __pyx_t_3 = __pyx_t_2;
-      goto __pyx_L38_bool_binop_done;
+      goto __pyx_L34_bool_binop_done;
     }
     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(short))) != 0);
     __pyx_t_3 = __pyx_t_2;
-    __pyx_L38_bool_binop_done:;
+    __pyx_L34_bool_binop_done:;
     if (__pyx_t_3) {
       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(__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_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
         goto __pyx_L10_break;
       }
       /*else*/ {
@@ -2788,18 +3090,18 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     if (!__pyx_t_2) {
     } else {
       __pyx_t_3 = __pyx_t_2;
-      goto __pyx_L42_bool_binop_done;
+      goto __pyx_L38_bool_binop_done;
     }
     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(int))) != 0);
     __pyx_t_3 = __pyx_t_2;
-    __pyx_L42_bool_binop_done:;
+    __pyx_L38_bool_binop_done:;
     if (__pyx_t_3) {
       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(__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_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
         goto __pyx_L10_break;
       }
       /*else*/ {
@@ -2810,40 +3112,18 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     if (!__pyx_t_2) {
     } else {
       __pyx_t_3 = __pyx_t_2;
-      goto __pyx_L46_bool_binop_done;
+      goto __pyx_L42_bool_binop_done;
     }
     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(long))) != 0);
     __pyx_t_3 = __pyx_t_2;
-    __pyx_L46_bool_binop_done:;
+    __pyx_L42_bool_binop_done:;
     if (__pyx_t_3) {
       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(__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_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __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_L50_bool_binop_done;
-    }
-    __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(PY_LONG_LONG))) != 0);
-    __pyx_t_3 = __pyx_t_2;
-    __pyx_L50_bool_binop_done:;
-    if (__pyx_t_3) {
-      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_PY_LONG_LONG(__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_kp_s_long_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
         goto __pyx_L10_break;
       }
       /*else*/ {
@@ -2854,18 +3134,18 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     if (!__pyx_t_2) {
     } else {
       __pyx_t_3 = __pyx_t_2;
-      goto __pyx_L54_bool_binop_done;
+      goto __pyx_L46_bool_binop_done;
     }
     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(float))) != 0);
     __pyx_t_3 = __pyx_t_2;
-    __pyx_L54_bool_binop_done:;
+    __pyx_L46_bool_binop_done:;
     if (__pyx_t_3) {
       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(__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_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
         goto __pyx_L10_break;
       }
       /*else*/ {
@@ -2876,80 +3156,80 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     if (!__pyx_t_2) {
     } else {
       __pyx_t_3 = __pyx_t_2;
-      goto __pyx_L58_bool_binop_done;
+      goto __pyx_L50_bool_binop_done;
     }
     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(double))) != 0);
     __pyx_t_3 = __pyx_t_2;
-    __pyx_L58_bool_binop_done:;
+    __pyx_L50_bool_binop_done:;
     if (__pyx_t_3) {
       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__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_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+    if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
     goto __pyx_L10_break;
   }
   __pyx_L10_break:;
   if (unlikely(__pyx_v_args == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
-    __PYX_ERR(0, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __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, 23, __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, 22, __pyx_L1_error)
   __pyx_t_3 = ((1 < __pyx_t_5) != 0);
   if (__pyx_t_3) {
     if (unlikely(__pyx_v_args == Py_None)) {
       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
-      __PYX_ERR(0, 23, __pyx_L1_error)
+      __PYX_ERR(0, 22, __pyx_L1_error)
     }
     __pyx_t_6 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 1);
     __Pyx_INCREF(__pyx_t_6);
     __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_6);
     __pyx_t_6 = 0;
-    goto __pyx_L61;
+    goto __pyx_L53;
   }
   __pyx_t_2 = (__pyx_v_kwargs != Py_None);
   __pyx_t_4 = (__pyx_t_2 != 0);
   if (__pyx_t_4) {
   } else {
     __pyx_t_3 = __pyx_t_4;
-    goto __pyx_L62_bool_binop_done;
+    goto __pyx_L54_bool_binop_done;
   }
   if (unlikely(__pyx_v_kwargs == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
-    __PYX_ERR(0, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __pyx_L1_error)
   }
-  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_taus, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_taus, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
   __pyx_t_2 = (__pyx_t_4 != 0);
   __pyx_t_3 = __pyx_t_2;
-  __pyx_L62_bool_binop_done:;
+  __pyx_L54_bool_binop_done:;
   if (__pyx_t_3) {
     if (unlikely(__pyx_v_kwargs == Py_None)) {
       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
-      __PYX_ERR(0, 23, __pyx_L1_error)
+      __PYX_ERR(0, 22, __pyx_L1_error)
     }
-    __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_taus); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_taus); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_6);
     __pyx_t_6 = 0;
-    goto __pyx_L61;
+    goto __pyx_L53;
   }
   /*else*/ {
     if (unlikely(__pyx_v_args == Py_None)) {
       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
-      __PYX_ERR(0, 23, __pyx_L1_error)
+      __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
-    __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __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, 22, __pyx_L1_error)
+    __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_int_2);
     __Pyx_GIVEREF(__pyx_int_2);
@@ -2960,17 +3240,17 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     __Pyx_GIVEREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
     __pyx_t_6 = 0;
-    __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __PYX_ERR(0, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __pyx_L1_error)
   }
-  __pyx_L61:;
+  __pyx_L53:;
   while (1) {
     __pyx_t_3 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None));
     __pyx_t_2 = (__pyx_t_3 != 0);
@@ -2978,52 +3258,52 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
       __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray); 
       __pyx_t_3 = (__pyx_t_2 != 0);
       if (__pyx_t_3) {
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_1);
         __pyx_t_1 = 0;
-        goto __pyx_L67;
+        goto __pyx_L59;
       }
       __pyx_t_3 = __pyx_memoryview_check(__pyx_v_arg); 
       __pyx_t_2 = (__pyx_t_3 != 0);
       if (__pyx_t_2) {
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_XDECREF_SET(__pyx_v_arg_base, __pyx_t_1);
         __pyx_t_1 = 0;
         __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray); 
         __pyx_t_3 = (__pyx_t_2 != 0);
         if (__pyx_t_3) {
-          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_1);
           __pyx_t_1 = 0;
-          goto __pyx_L68;
+          goto __pyx_L60;
         }
         /*else*/ {
           __Pyx_INCREF(Py_None);
           __Pyx_XDECREF_SET(__pyx_v_dtype, Py_None);
         }
-        __pyx_L68:;
-        goto __pyx_L67;
+        __pyx_L60:;
+        goto __pyx_L59;
       }
       /*else*/ {
         __Pyx_INCREF(Py_None);
         __Pyx_XDECREF_SET(__pyx_v_dtype, Py_None);
       }
-      __pyx_L67:;
+      __pyx_L59:;
       __pyx_v_itemsize = -1L;
       __pyx_t_3 = (__pyx_v_dtype != Py_None);
       __pyx_t_2 = (__pyx_t_3 != 0);
       if (__pyx_t_2) {
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __pyx_v_itemsize = __pyx_t_5;
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __pyx_v_kind = __pyx_t_7;
         __pyx_v_dtype_signed = (__pyx_v_kind == 'i');
@@ -3034,93 +3314,70 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
           if (__pyx_t_3) {
           } else {
             __pyx_t_2 = __pyx_t_3;
-            goto __pyx_L71_bool_binop_done;
+            goto __pyx_L63_bool_binop_done;
           }
-          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           __pyx_t_3 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
           if (__pyx_t_3) {
           } else {
             __pyx_t_2 = __pyx_t_3;
-            goto __pyx_L71_bool_binop_done;
+            goto __pyx_L63_bool_binop_done;
           }
           __pyx_t_3 = ((!((__pyx_v_short_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0);
           __pyx_t_2 = __pyx_t_3;
-          __pyx_L71_bool_binop_done:;
+          __pyx_L63_bool_binop_done:;
           if (__pyx_t_2) {
-            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-            goto __pyx_L65_break;
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
+            goto __pyx_L57_break;
           }
           __pyx_t_3 = (((sizeof(int)) == __pyx_v_itemsize) != 0);
           if (__pyx_t_3) {
           } else {
             __pyx_t_2 = __pyx_t_3;
-            goto __pyx_L75_bool_binop_done;
+            goto __pyx_L67_bool_binop_done;
           }
-          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           __pyx_t_3 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
           if (__pyx_t_3) {
           } else {
             __pyx_t_2 = __pyx_t_3;
-            goto __pyx_L75_bool_binop_done;
+            goto __pyx_L67_bool_binop_done;
           }
           __pyx_t_3 = ((!((__pyx_v_int_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0);
           __pyx_t_2 = __pyx_t_3;
-          __pyx_L75_bool_binop_done:;
+          __pyx_L67_bool_binop_done:;
           if (__pyx_t_2) {
-            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-            goto __pyx_L65_break;
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
+            goto __pyx_L57_break;
           }
           __pyx_t_3 = (((sizeof(long)) == __pyx_v_itemsize) != 0);
           if (__pyx_t_3) {
           } else {
             __pyx_t_2 = __pyx_t_3;
-            goto __pyx_L79_bool_binop_done;
+            goto __pyx_L71_bool_binop_done;
           }
-          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L1_error)
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           __pyx_t_3 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
           if (__pyx_t_3) {
           } else {
             __pyx_t_2 = __pyx_t_3;
-            goto __pyx_L79_bool_binop_done;
+            goto __pyx_L71_bool_binop_done;
           }
           __pyx_t_3 = ((!((__pyx_v_long_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0);
           __pyx_t_2 = __pyx_t_3;
-          __pyx_L79_bool_binop_done:;
-          if (__pyx_t_2) {
-            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-            goto __pyx_L65_break;
-          }
-          __pyx_t_3 = (((sizeof(PY_LONG_LONG)) == __pyx_v_itemsize) != 0);
-          if (__pyx_t_3) {
-          } else {
-            __pyx_t_2 = __pyx_t_3;
-            goto __pyx_L83_bool_binop_done;
-          }
-          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L1_error)
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __pyx_t_3 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
-          if (__pyx_t_3) {
-          } else {
-            __pyx_t_2 = __pyx_t_3;
-            goto __pyx_L83_bool_binop_done;
-          }
-          __pyx_t_3 = ((!((__pyx_v_long_long_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0);
-          __pyx_t_2 = __pyx_t_3;
-          __pyx_L83_bool_binop_done:;
+          __pyx_L71_bool_binop_done:;
           if (__pyx_t_2) {
-            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_kp_s_long_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-            goto __pyx_L65_break;
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
+            goto __pyx_L57_break;
           }
           break;
           case 'f':
@@ -3137,19 +3394,19 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     if (!__pyx_t_3) {
     } else {
       __pyx_t_2 = __pyx_t_3;
-      goto __pyx_L87_bool_binop_done;
+      goto __pyx_L75_bool_binop_done;
     }
     __pyx_t_3 = ((__pyx_v_itemsize == (sizeof(short))) != 0);
     __pyx_t_2 = __pyx_t_3;
-    __pyx_L87_bool_binop_done:;
+    __pyx_L75_bool_binop_done:;
     if (__pyx_t_2) {
       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(__pyx_v_arg, 0); 
       __pyx_v_memslice = __pyx_t_8;
       __pyx_t_2 = (__pyx_v_memslice.memview != 0);
       if (__pyx_t_2) {
         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); 
-        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-        goto __pyx_L65_break;
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
+        goto __pyx_L57_break;
       }
       /*else*/ {
         PyErr_Clear(); 
@@ -3159,19 +3416,19 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     if (!__pyx_t_3) {
     } else {
       __pyx_t_2 = __pyx_t_3;
-      goto __pyx_L91_bool_binop_done;
+      goto __pyx_L79_bool_binop_done;
     }
     __pyx_t_3 = ((__pyx_v_itemsize == (sizeof(int))) != 0);
     __pyx_t_2 = __pyx_t_3;
-    __pyx_L91_bool_binop_done:;
+    __pyx_L79_bool_binop_done:;
     if (__pyx_t_2) {
       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(__pyx_v_arg, 0); 
       __pyx_v_memslice = __pyx_t_8;
       __pyx_t_2 = (__pyx_v_memslice.memview != 0);
       if (__pyx_t_2) {
         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); 
-        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-        goto __pyx_L65_break;
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
+        goto __pyx_L57_break;
       }
       /*else*/ {
         PyErr_Clear(); 
@@ -3181,60 +3438,38 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     if (!__pyx_t_3) {
     } else {
       __pyx_t_2 = __pyx_t_3;
-      goto __pyx_L95_bool_binop_done;
+      goto __pyx_L83_bool_binop_done;
     }
     __pyx_t_3 = ((__pyx_v_itemsize == (sizeof(long))) != 0);
     __pyx_t_2 = __pyx_t_3;
-    __pyx_L95_bool_binop_done:;
+    __pyx_L83_bool_binop_done:;
     if (__pyx_t_2) {
       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(__pyx_v_arg, 0); 
       __pyx_v_memslice = __pyx_t_8;
       __pyx_t_2 = (__pyx_v_memslice.memview != 0);
       if (__pyx_t_2) {
         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); 
-        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-        goto __pyx_L65_break;
-      }
-      /*else*/ {
-        PyErr_Clear(); 
-      }
-    }
-    __pyx_t_3 = ((__pyx_v_itemsize == -1L) != 0);
-    if (!__pyx_t_3) {
-    } else {
-      __pyx_t_2 = __pyx_t_3;
-      goto __pyx_L99_bool_binop_done;
-    }
-    __pyx_t_3 = ((__pyx_v_itemsize == (sizeof(PY_LONG_LONG))) != 0);
-    __pyx_t_2 = __pyx_t_3;
-    __pyx_L99_bool_binop_done:;
-    if (__pyx_t_2) {
-      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(__pyx_v_arg, 0); 
-      __pyx_v_memslice = __pyx_t_8;
-      __pyx_t_2 = (__pyx_v_memslice.memview != 0);
-      if (__pyx_t_2) {
-        __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); 
-        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_kp_s_long_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-        goto __pyx_L65_break;
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
+        goto __pyx_L57_break;
       }
       /*else*/ {
         PyErr_Clear(); 
       }
     }
-    if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
-    goto __pyx_L65_break;
+    if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
+    goto __pyx_L57_break;
   }
-  __pyx_L65_break:;
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_L57_break:;
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_v_candidates = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
   __pyx_t_5 = 0;
   if (unlikely(__pyx_v_signatures == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
-    __PYX_ERR(0, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __pyx_L1_error)
   }
-  __pyx_t_6 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_6 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_1);
   __pyx_t_1 = __pyx_t_6;
@@ -3242,12 +3477,12 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
   while (1) {
     __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_9, &__pyx_t_5, &__pyx_t_6, NULL, NULL, __pyx_t_10);
     if (unlikely(__pyx_t_11 == 0)) break;
-    if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 23, __pyx_L1_error)
+    if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_6);
     __pyx_t_6 = 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, 23, __pyx_L1_error)
+    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_13);
     __pyx_t_14 = NULL;
     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
@@ -3261,10 +3496,10 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     }
     __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, 23, __pyx_L1_error)
+    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_13);
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
     __pyx_t_12 = NULL;
@@ -3279,12 +3514,12 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
     }
     __pyx_t_6 = (__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_6)) __PYX_ERR(0, 23, __pyx_L1_error)
+    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
     __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_6);
     __pyx_t_6 = 0;
-    __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 22, __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;
@@ -3295,55 +3530,55 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
       __pyx_t_2 = (__pyx_v_dst_type != Py_None);
       __pyx_t_3 = (__pyx_t_2 != 0);
       if (__pyx_t_3) {
-        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_13 = PyObject_RichCompare(__pyx_t_6, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_13 = PyObject_RichCompare(__pyx_t_6, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
+        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
         if (__pyx_t_3) {
           __pyx_v_match_found = 1;
-          goto __pyx_L107;
+          goto __pyx_L91;
         }
         /*else*/ {
           __pyx_v_match_found = 0;
-          goto __pyx_L105_break;
+          goto __pyx_L89_break;
         }
-        __pyx_L107:;
+        __pyx_L91:;
       }
     }
-    __pyx_L105_break:;
+    __pyx_L89_break:;
     __pyx_t_3 = (__pyx_v_match_found != 0);
     if (__pyx_t_3) {
-      __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 23, __pyx_L1_error)
+      __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 22, __pyx_L1_error)
     }
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_3 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
   __pyx_t_2 = ((!__pyx_t_3) != 0);
   if (__pyx_t_2) {
-    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __PYX_ERR(0, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __pyx_L1_error)
   }
-  __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 22, __pyx_L1_error)
   __pyx_t_2 = ((__pyx_t_9 > 1) != 0);
   if (__pyx_t_2) {
-    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __PYX_ERR(0, 23, __pyx_L1_error)
+    __PYX_ERR(0, 22, __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, 23, __pyx_L1_error)
+      __PYX_ERR(0, 22, __pyx_L1_error)
     }
-    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
@@ -3376,14 +3611,17 @@ static PyObject *__pyx_pf_6c_corr_c_corr(CYTHON_UNUSED PyObject *__pyx_self, PyO
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_0_0__pyx_pw_6c_corr_3c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_0_0__pyx_mdef_6c_corr_3c_corr = {"__pyx_fuse_0_0c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_0__pyx_pw_6c_corr_3c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_0_0__pyx_pw_6c_corr_3c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_0_0__pyx_pw_6c_corr_7c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_0_0__pyx_mdef_6c_corr_7c_corr_at = {"__pyx_fuse_0_0c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_0__pyx_pw_6c_corr_7c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_0_0__pyx_pw_6c_corr_7c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -3407,11 +3645,11 @@ static PyObject *__pyx_fuse_0_0__pyx_pw_6c_corr_3c_corr(PyObject *__pyx_self, Py
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -3419,25 +3657,25 @@ static PyObject *__pyx_fuse_0_0__pyx_pw_6c_corr_3c_corr(PyObject *__pyx_self, Py
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_2c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_6c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_6c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -3462,19 +3700,22 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_0_0c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_0_0c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -3482,7 +3723,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -3491,7 +3732,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -3500,7 +3741,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -3509,7 +3750,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -3521,7 +3762,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -3530,7 +3771,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -3542,7 +3783,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -3556,7 +3797,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
       __pyx_v_corr_val = (__pyx_v_corr_val * (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -3566,7 +3807,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -3575,15 +3816,16 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -3593,18 +3835,20 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -3619,12 +3863,12 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -3636,10 +3880,10 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -3650,7 +3894,7 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -3661,14 +3905,17 @@ static PyObject *__pyx_pf_6c_corr_2c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_0_1__pyx_pw_6c_corr_5c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_0_1__pyx_mdef_6c_corr_5c_corr = {"__pyx_fuse_0_1c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_1__pyx_pw_6c_corr_5c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_0_1__pyx_pw_6c_corr_5c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_0_1__pyx_pw_6c_corr_9c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_0_1__pyx_mdef_6c_corr_9c_corr_at = {"__pyx_fuse_0_1c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_1__pyx_pw_6c_corr_9c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_0_1__pyx_pw_6c_corr_9c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -3692,11 +3939,11 @@ static PyObject *__pyx_fuse_0_1__pyx_pw_6c_corr_5c_corr(PyObject *__pyx_self, Py
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -3704,25 +3951,25 @@ static PyObject *__pyx_fuse_0_1__pyx_pw_6c_corr_5c_corr(PyObject *__pyx_self, Py
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_4c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_8c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_8c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -3747,19 +3994,22 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_0_1c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_0_1c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -3767,7 +4017,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -3776,7 +4026,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -3785,7 +4035,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -3794,7 +4044,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -3806,7 +4056,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -3815,7 +4065,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -3827,7 +4077,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -3841,7 +4091,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
       __pyx_v_corr_val = (__pyx_v_corr_val * (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -3851,7 +4101,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -3860,15 +4110,16 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -3878,18 +4129,20 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -3904,12 +4157,12 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -3921,10 +4174,10 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -3935,7 +4188,7 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -3946,14 +4199,17 @@ static PyObject *__pyx_pf_6c_corr_4c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_0_2__pyx_pw_6c_corr_7c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_0_2__pyx_mdef_6c_corr_7c_corr = {"__pyx_fuse_0_2c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_2__pyx_pw_6c_corr_7c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_0_2__pyx_pw_6c_corr_7c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_0_2__pyx_pw_6c_corr_11c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_0_2__pyx_mdef_6c_corr_11c_corr_at = {"__pyx_fuse_0_2c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_2__pyx_pw_6c_corr_11c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_0_2__pyx_pw_6c_corr_11c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -3977,11 +4233,11 @@ static PyObject *__pyx_fuse_0_2__pyx_pw_6c_corr_7c_corr(PyObject *__pyx_self, Py
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -3989,25 +4245,25 @@ static PyObject *__pyx_fuse_0_2__pyx_pw_6c_corr_7c_corr(PyObject *__pyx_self, Py
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_6c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_10c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_10c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -4032,19 +4288,22 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_0_2c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_0_2c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -4052,7 +4311,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -4061,7 +4320,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -4070,7 +4329,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -4079,7 +4338,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -4091,7 +4350,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -4100,7 +4359,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -4112,7 +4371,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -4126,7 +4385,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
       __pyx_v_corr_val = (__pyx_v_corr_val * (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -4136,7 +4395,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -4145,15 +4404,16 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -4163,18 +4423,20 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -4189,12 +4451,12 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -4206,10 +4468,10 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -4220,7 +4482,7 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -4231,14 +4493,17 @@ static PyObject *__pyx_pf_6c_corr_6c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_0_3__pyx_pw_6c_corr_9c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_0_3__pyx_mdef_6c_corr_9c_corr = {"__pyx_fuse_0_3c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_3__pyx_pw_6c_corr_9c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_0_3__pyx_pw_6c_corr_9c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_1_0__pyx_pw_6c_corr_13c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_1_0__pyx_mdef_6c_corr_13c_corr_at = {"__pyx_fuse_1_0c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_0__pyx_pw_6c_corr_13c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_1_0__pyx_pw_6c_corr_13c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -4262,11 +4527,11 @@ static PyObject *__pyx_fuse_0_3__pyx_pw_6c_corr_9c_corr(PyObject *__pyx_self, Py
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -4274,25 +4539,25 @@ static PyObject *__pyx_fuse_0_3__pyx_pw_6c_corr_9c_corr(PyObject *__pyx_self, Py
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_8c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_12c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_12c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -4311,25 +4576,28 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   Py_ssize_t __pyx_t_7;
   Py_ssize_t __pyx_t_8;
   Py_ssize_t __pyx_t_9;
-  PY_LONG_LONG __pyx_t_10;
+  Py_ssize_t __pyx_t_10;
   int __pyx_t_11;
   PyObject *__pyx_t_12 = NULL;
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_0_3c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_1_0c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -4337,7 +4605,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -4346,7 +4614,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -4355,7 +4623,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -4364,7 +4632,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -4376,7 +4644,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -4385,7 +4653,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -4397,7 +4665,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -4407,11 +4675,11 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((PY_LONG_LONG *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((PY_LONG_LONG *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_t_10 = (*((short *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -4421,7 +4689,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -4430,15 +4698,16 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -4448,18 +4717,20 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -4474,12 +4745,12 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -4491,10 +4762,10 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -4505,7 +4776,7 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -4516,14 +4787,17 @@ static PyObject *__pyx_pf_6c_corr_8c_corr(CYTHON_UNUSED PyObject *__pyx_self, __
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_1_0__pyx_pw_6c_corr_11c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_1_0__pyx_mdef_6c_corr_11c_corr = {"__pyx_fuse_1_0c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_0__pyx_pw_6c_corr_11c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_1_0__pyx_pw_6c_corr_11c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_1_1__pyx_pw_6c_corr_15c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_1_1__pyx_mdef_6c_corr_15c_corr_at = {"__pyx_fuse_1_1c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_1__pyx_pw_6c_corr_15c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_1_1__pyx_pw_6c_corr_15c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -4547,11 +4821,11 @@ static PyObject *__pyx_fuse_1_0__pyx_pw_6c_corr_11c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -4559,25 +4833,25 @@ static PyObject *__pyx_fuse_1_0__pyx_pw_6c_corr_11c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_10c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_14c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_14c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -4602,19 +4876,22 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_1_0c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_1_1c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -4622,7 +4899,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -4631,7 +4908,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -4640,7 +4917,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -4649,7 +4926,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -4661,7 +4938,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -4670,7 +4947,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -4682,7 +4959,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -4692,11 +4969,11 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((short *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_t_10 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
       __pyx_v_corr_val = (__pyx_v_corr_val * (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -4706,7 +4983,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -4715,15 +4992,16 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -4733,18 +5011,20 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -4759,12 +5039,12 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -4776,10 +5056,10 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -4790,7 +5070,7 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -4801,14 +5081,17 @@ static PyObject *__pyx_pf_6c_corr_10c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_1_1__pyx_pw_6c_corr_13c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_1_1__pyx_mdef_6c_corr_13c_corr = {"__pyx_fuse_1_1c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_1__pyx_pw_6c_corr_13c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_1_1__pyx_pw_6c_corr_13c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_1_2__pyx_pw_6c_corr_17c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_1_2__pyx_mdef_6c_corr_17c_corr_at = {"__pyx_fuse_1_2c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_2__pyx_pw_6c_corr_17c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_1_2__pyx_pw_6c_corr_17c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -4832,11 +5115,11 @@ static PyObject *__pyx_fuse_1_1__pyx_pw_6c_corr_13c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -4844,25 +5127,25 @@ static PyObject *__pyx_fuse_1_1__pyx_pw_6c_corr_13c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_12c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_16c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_16c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -4887,19 +5170,22 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_1_1c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_1_2c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -4907,7 +5193,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -4916,7 +5202,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -4925,7 +5211,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -4934,7 +5220,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -4946,7 +5232,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -4955,7 +5241,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -4967,7 +5253,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -4977,11 +5263,11 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_t_10 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
       __pyx_v_corr_val = (__pyx_v_corr_val * (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -4991,7 +5277,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -5000,15 +5286,16 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -5018,18 +5305,20 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -5044,12 +5333,12 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -5061,10 +5350,10 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -5075,7 +5364,7 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -5086,14 +5375,17 @@ static PyObject *__pyx_pf_6c_corr_12c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_1_2__pyx_pw_6c_corr_15c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_1_2__pyx_mdef_6c_corr_15c_corr = {"__pyx_fuse_1_2c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_2__pyx_pw_6c_corr_15c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_1_2__pyx_pw_6c_corr_15c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_2_0__pyx_pw_6c_corr_19c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_2_0__pyx_mdef_6c_corr_19c_corr_at = {"__pyx_fuse_2_0c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_0__pyx_pw_6c_corr_19c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_2_0__pyx_pw_6c_corr_19c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -5117,11 +5409,11 @@ static PyObject *__pyx_fuse_1_2__pyx_pw_6c_corr_15c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -5129,25 +5421,25 @@ static PyObject *__pyx_fuse_1_2__pyx_pw_6c_corr_15c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_14c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_18c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_18c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -5172,19 +5464,22 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_1_2c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_2_0c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -5192,7 +5487,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -5201,7 +5496,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -5210,7 +5505,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -5219,7 +5514,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -5231,7 +5526,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -5240,7 +5535,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -5252,7 +5547,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -5262,11 +5557,11 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_t_10 = (*((short *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -5276,7 +5571,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -5285,15 +5580,16 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -5303,18 +5599,20 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -5329,12 +5627,12 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -5346,10 +5644,10 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -5360,7 +5658,7 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -5371,14 +5669,17 @@ static PyObject *__pyx_pf_6c_corr_14c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_1_3__pyx_pw_6c_corr_17c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_1_3__pyx_mdef_6c_corr_17c_corr = {"__pyx_fuse_1_3c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_3__pyx_pw_6c_corr_17c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_1_3__pyx_pw_6c_corr_17c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_2_1__pyx_pw_6c_corr_21c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_2_1__pyx_mdef_6c_corr_21c_corr_at = {"__pyx_fuse_2_1c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_1__pyx_pw_6c_corr_21c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_2_1__pyx_pw_6c_corr_21c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -5402,11 +5703,11 @@ static PyObject *__pyx_fuse_1_3__pyx_pw_6c_corr_17c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -5414,25 +5715,25 @@ static PyObject *__pyx_fuse_1_3__pyx_pw_6c_corr_17c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_16c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_20c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_20c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -5451,25 +5752,28 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   Py_ssize_t __pyx_t_7;
   Py_ssize_t __pyx_t_8;
   Py_ssize_t __pyx_t_9;
-  PY_LONG_LONG __pyx_t_10;
+  Py_ssize_t __pyx_t_10;
   int __pyx_t_11;
   PyObject *__pyx_t_12 = NULL;
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_1_3c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_2_1c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -5477,7 +5781,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -5486,7 +5790,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -5495,7 +5799,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -5504,7 +5808,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -5516,7 +5820,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -5525,7 +5829,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -5537,7 +5841,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -5547,11 +5851,11 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((PY_LONG_LONG *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((PY_LONG_LONG *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_t_10 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -5561,7 +5865,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -5570,15 +5874,16 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -5588,18 +5893,20 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -5614,12 +5921,12 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -5631,10 +5938,10 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -5645,7 +5952,7 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -5656,14 +5963,17 @@ static PyObject *__pyx_pf_6c_corr_16c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_2_0__pyx_pw_6c_corr_19c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_2_0__pyx_mdef_6c_corr_19c_corr = {"__pyx_fuse_2_0c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_0__pyx_pw_6c_corr_19c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_2_0__pyx_pw_6c_corr_19c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_2_2__pyx_pw_6c_corr_23c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_2_2__pyx_mdef_6c_corr_23c_corr_at = {"__pyx_fuse_2_2c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_2__pyx_pw_6c_corr_23c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_2_2__pyx_pw_6c_corr_23c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -5687,11 +5997,11 @@ static PyObject *__pyx_fuse_2_0__pyx_pw_6c_corr_19c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -5699,25 +6009,25 @@ static PyObject *__pyx_fuse_2_0__pyx_pw_6c_corr_19c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_18c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_22c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_22c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -5742,19 +6052,22 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_2_0c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_2_2c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -5762,7 +6075,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -5771,7 +6084,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -5780,7 +6093,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -5789,7 +6102,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -5801,7 +6114,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -5810,7 +6123,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -5822,7 +6135,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -5832,11 +6145,11 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((short *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_t_10 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
       __pyx_v_corr_val = (__pyx_v_corr_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -5846,7 +6159,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -5855,15 +6168,16 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -5873,18 +6187,20 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -5899,12 +6215,12 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -5916,10 +6232,10 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -5930,7 +6246,7 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -5941,14 +6257,17 @@ static PyObject *__pyx_pf_6c_corr_18c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_2_1__pyx_pw_6c_corr_21c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_2_1__pyx_mdef_6c_corr_21c_corr = {"__pyx_fuse_2_1c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_1__pyx_pw_6c_corr_21c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_2_1__pyx_pw_6c_corr_21c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_3_0__pyx_pw_6c_corr_25c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_3_0__pyx_mdef_6c_corr_25c_corr_at = {"__pyx_fuse_3_0c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_0__pyx_pw_6c_corr_25c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_3_0__pyx_pw_6c_corr_25c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -5972,11 +6291,11 @@ static PyObject *__pyx_fuse_2_1__pyx_pw_6c_corr_21c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -5984,25 +6303,25 @@ static PyObject *__pyx_fuse_2_1__pyx_pw_6c_corr_21c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_20c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_24c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_24c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -6027,19 +6346,22 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_2_1c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_3_0c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -6047,7 +6369,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -6056,7 +6378,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -6065,7 +6387,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -6074,7 +6396,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -6086,7 +6408,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -6095,7 +6417,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -6107,7 +6429,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -6117,11 +6439,11 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_t_10 = (*((short *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -6131,7 +6453,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -6140,15 +6462,16 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -6158,18 +6481,20 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -6184,12 +6509,12 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -6201,10 +6526,10 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -6215,7 +6540,7 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -6226,14 +6551,17 @@ static PyObject *__pyx_pf_6c_corr_20c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_2_2__pyx_pw_6c_corr_23c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_2_2__pyx_mdef_6c_corr_23c_corr = {"__pyx_fuse_2_2c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_2__pyx_pw_6c_corr_23c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_2_2__pyx_pw_6c_corr_23c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_3_1__pyx_pw_6c_corr_27c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_3_1__pyx_mdef_6c_corr_27c_corr_at = {"__pyx_fuse_3_1c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_1__pyx_pw_6c_corr_27c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_3_1__pyx_pw_6c_corr_27c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -6257,11 +6585,11 @@ static PyObject *__pyx_fuse_2_2__pyx_pw_6c_corr_23c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -6269,25 +6597,25 @@ static PyObject *__pyx_fuse_2_2__pyx_pw_6c_corr_23c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_22c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_26c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_26c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -6312,19 +6640,22 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_2_2c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_3_1c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -6332,7 +6663,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -6341,7 +6672,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -6350,7 +6681,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -6359,7 +6690,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -6371,7 +6702,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -6380,7 +6711,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -6392,7 +6723,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -6402,11 +6733,11 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_t_10 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -6416,7 +6747,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -6425,15 +6756,16 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -6443,18 +6775,20 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -6469,12 +6803,12 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -6486,10 +6820,10 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -6500,7 +6834,7 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -6511,14 +6845,17 @@ static PyObject *__pyx_pf_6c_corr_22c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_2_3__pyx_pw_6c_corr_25c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_2_3__pyx_mdef_6c_corr_25c_corr = {"__pyx_fuse_2_3c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_3__pyx_pw_6c_corr_25c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_2_3__pyx_pw_6c_corr_25c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_3_2__pyx_pw_6c_corr_29c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_3_2__pyx_mdef_6c_corr_29c_corr_at = {"__pyx_fuse_3_2c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_2__pyx_pw_6c_corr_29c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_3_2__pyx_pw_6c_corr_29c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -6542,11 +6879,11 @@ static PyObject *__pyx_fuse_2_3__pyx_pw_6c_corr_25c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -6554,25 +6891,25 @@ static PyObject *__pyx_fuse_2_3__pyx_pw_6c_corr_25c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_24c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_28c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_28c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -6591,25 +6928,28 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   Py_ssize_t __pyx_t_7;
   Py_ssize_t __pyx_t_8;
   Py_ssize_t __pyx_t_9;
-  PY_LONG_LONG __pyx_t_10;
+  Py_ssize_t __pyx_t_10;
   int __pyx_t_11;
   PyObject *__pyx_t_12 = NULL;
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_2_3c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_3_2c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -6617,7 +6957,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -6626,7 +6966,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -6635,7 +6975,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -6644,7 +6984,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -6656,7 +6996,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -6665,7 +7005,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -6677,7 +7017,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -6687,11 +7027,11 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_7 = __pyx_v_p;
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((PY_LONG_LONG *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((PY_LONG_LONG *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_t_10 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -6701,7 +7041,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -6710,15 +7050,16 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -6728,18 +7069,20 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -6754,12 +7097,12 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -6771,10 +7114,10 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -6785,7 +7128,7 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -6796,14 +7139,17 @@ static PyObject *__pyx_pf_6c_corr_24c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_3_0__pyx_pw_6c_corr_27c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_3_0__pyx_mdef_6c_corr_27c_corr = {"__pyx_fuse_3_0c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_0__pyx_pw_6c_corr_27c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_3_0__pyx_pw_6c_corr_27c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_4_0__pyx_pw_6c_corr_31c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_4_0__pyx_mdef_6c_corr_31c_corr_at = {"__pyx_fuse_4_0c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_0__pyx_pw_6c_corr_31c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_4_0__pyx_pw_6c_corr_31c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -6827,11 +7173,11 @@ static PyObject *__pyx_fuse_3_0__pyx_pw_6c_corr_27c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -6839,25 +7185,25 @@ static PyObject *__pyx_fuse_3_0__pyx_pw_6c_corr_27c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_PY_LONG_LONG(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_26c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_30c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_30c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -6882,19 +7228,22 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_3_0c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_4_0c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -6902,7 +7251,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -6911,7 +7260,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -6920,7 +7269,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -6929,7 +7278,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -6941,7 +7290,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -6950,7 +7299,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -6962,7 +7311,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -6973,10 +7322,10 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
       __pyx_t_10 = (*((short *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((PY_LONG_LONG *) ( /* dim=1 */ ((char *) (((PY_LONG_LONG *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -6986,7 +7335,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -6995,15 +7344,16 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -7013,18 +7363,20 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -7039,12 +7391,12 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -7056,10 +7408,10 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -7070,7 +7422,7 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -7081,14 +7433,17 @@ static PyObject *__pyx_pf_6c_corr_26c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_3_1__pyx_pw_6c_corr_29c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_3_1__pyx_mdef_6c_corr_29c_corr = {"__pyx_fuse_3_1c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_1__pyx_pw_6c_corr_29c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_3_1__pyx_pw_6c_corr_29c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_4_1__pyx_pw_6c_corr_33c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_4_1__pyx_mdef_6c_corr_33c_corr_at = {"__pyx_fuse_4_1c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_1__pyx_pw_6c_corr_33c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_4_1__pyx_pw_6c_corr_33c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -7112,11 +7467,11 @@ static PyObject *__pyx_fuse_3_1__pyx_pw_6c_corr_29c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -7124,25 +7479,25 @@ static PyObject *__pyx_fuse_3_1__pyx_pw_6c_corr_29c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_PY_LONG_LONG(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_28c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_32c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_32c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -7167,19 +7522,22 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_3_1c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_4_1c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -7187,7 +7545,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -7196,7 +7554,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -7205,7 +7563,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -7214,7 +7572,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -7226,7 +7584,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -7235,7 +7593,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -7247,7 +7605,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -7258,10 +7616,10 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
       __pyx_t_10 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((PY_LONG_LONG *) ( /* dim=1 */ ((char *) (((PY_LONG_LONG *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -7271,7 +7629,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -7280,15 +7638,16 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -7298,18 +7657,20 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -7324,12 +7685,12 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -7341,10 +7702,10 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -7355,7 +7716,7 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -7366,14 +7727,17 @@ static PyObject *__pyx_pf_6c_corr_28c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_3_2__pyx_pw_6c_corr_31c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_3_2__pyx_mdef_6c_corr_31c_corr = {"__pyx_fuse_3_2c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_2__pyx_pw_6c_corr_31c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_3_2__pyx_pw_6c_corr_31c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_4_2__pyx_pw_6c_corr_35c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_4_2__pyx_mdef_6c_corr_35c_corr_at = {"__pyx_fuse_4_2c_corr_at", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_2__pyx_pw_6c_corr_35c_corr_at, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_c_corr_at};
+static PyObject *__pyx_fuse_4_2__pyx_pw_6c_corr_35c_corr_at(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("c_corr_at (wrapper)", 0);
   {
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
     PyObject* values[2] = {0,0};
@@ -7397,11 +7761,11 @@ static PyObject *__pyx_fuse_3_2__pyx_pw_6c_corr_31c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr_at") < 0)) __PYX_ERR(0, 22, __pyx_L3_error)
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -7409,25 +7773,25 @@ static PyObject *__pyx_fuse_3_2__pyx_pw_6c_corr_31c_corr(PyObject *__pyx_self, P
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_PY_LONG_LONG(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("c_corr_at", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_30c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_34c_corr_at(__pyx_self, __pyx_v_cc, __pyx_v_taus);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
+static PyObject *__pyx_pf_6c_corr_34c_corr_at(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
   Py_ssize_t __pyx_v_total;
   Py_ssize_t __pyx_v_n_pair;
   double __pyx_v_max_corr_val;
@@ -7452,19 +7816,22 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
   PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_3_2c_corr", 0);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_4_2c_corr_at", 0);
 
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":23
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]             # <<<<<<<<<<<<<<
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  */
   __pyx_v_total = (__pyx_v_taus.shape[1]);
 
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
+  /* "c_corr.pyx":24
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
  *     cdef double max_corr_val = 0.0
@@ -7472,7 +7839,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
 
-  /* "c_corr.pyx":26
+  /* "c_corr.pyx":25
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -7481,7 +7848,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_max_corr_val = 0.0;
 
-  /* "c_corr.pyx":27
+  /* "c_corr.pyx":26
  *     n_pair = taus.shape[0]
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0             # <<<<<<<<<<<<<<
@@ -7490,7 +7857,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_index = 0;
 
-  /* "c_corr.pyx":28
+  /* "c_corr.pyx":27
  *     cdef double max_corr_val = 0.0
  *     cdef int index = 0
  *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
@@ -7499,7 +7866,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
   __pyx_v_corr_val = 0.0;
 
-  /* "c_corr.pyx":29
+  /* "c_corr.pyx":28
  *     cdef int index = 0
  *     cdef double corr_val = 0.0
  *     for i in range(total):             # <<<<<<<<<<<<<<
@@ -7511,7 +7878,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
     __pyx_v_i = __pyx_t_3;
 
-    /* "c_corr.pyx":30
+    /* "c_corr.pyx":29
  *     cdef double corr_val = 0.0
  *     for i in range(total):
  *         corr_val = 1.0             # <<<<<<<<<<<<<<
@@ -7520,7 +7887,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
     __pyx_v_corr_val = 1.0;
 
-    /* "c_corr.pyx":31
+    /* "c_corr.pyx":30
  *     for i in range(total):
  *         corr_val = 1.0
  *         for p in range(n_pair):             # <<<<<<<<<<<<<<
@@ -7532,7 +7899,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
       __pyx_v_p = __pyx_t_6;
 
-      /* "c_corr.pyx":32
+      /* "c_corr.pyx":31
  *         corr_val = 1.0
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
@@ -7543,10 +7910,10 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_p;
       __pyx_t_10 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((PY_LONG_LONG *) ( /* dim=1 */ ((char *) (((PY_LONG_LONG *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+      __pyx_v_corr_val = (__pyx_v_corr_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
     }
 
-    /* "c_corr.pyx":33
+    /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -7556,7 +7923,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
     if (__pyx_t_11) {
 
-      /* "c_corr.pyx":34
+      /* "c_corr.pyx":33
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
@@ -7565,15 +7932,16 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
  */
       __pyx_v_max_corr_val = __pyx_v_corr_val;
 
-      /* "c_corr.pyx":35
+      /* "c_corr.pyx":34
  *         if corr_val > max_corr_val:
  *             max_corr_val = corr_val
  *             index = i             # <<<<<<<<<<<<<<
  *     return np.log10(max_corr_val), index
+ * 
  */
       __pyx_v_index = __pyx_v_i;
 
-      /* "c_corr.pyx":33
+      /* "c_corr.pyx":32
  *         for p in range(n_pair):
  *             corr_val *= cc[p, taus[p, i]]
  *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
@@ -7583,18 +7951,20 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
     }
   }
 
-  /* "c_corr.pyx":36
+  /* "c_corr.pyx":35
  *             max_corr_val = corr_val
  *             index = i
  *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __pyx_t_15 = NULL;
   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -7609,12 +7979,12 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
+  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 35, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_12);
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
@@ -7626,10 +7996,10 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __pyx_t_13 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
@@ -7640,7 +8010,7 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.c_corr_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
@@ -7650,22 +8020,40 @@ static PyObject *__pyx_pf_6c_corr_30c_corr(CYTHON_UNUSED PyObject *__pyx_self, _
   return __pyx_r;
 }
 
+/* "c_corr.pyx":41
+ * @cython.wraparound(False)
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):             # <<<<<<<<<<<<<<
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ */
+
 /* Python wrapper */
-static PyObject *__pyx_fuse_3_3__pyx_pw_6c_corr_33c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_3_3__pyx_mdef_6c_corr_33c_corr = {"__pyx_fuse_3_3c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_3__pyx_pw_6c_corr_33c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_3_3__pyx_pw_6c_corr_33c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+static PyObject *__pyx_pw_6c_corr_3c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6c_corr_2c_corr_all[] = "c_corr_all(signatures, args, kwargs, defaults)";
+static PyMethodDef __pyx_mdef_6c_corr_3c_corr_all = {"c_corr_all", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6c_corr_3c_corr_all, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_2c_corr_all};
+static PyObject *__pyx_pw_6c_corr_3c_corr_all(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;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,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);
@@ -7676,281 +8064,7272 @@ static PyObject *__pyx_fuse_3_3__pyx_pw_6c_corr_33c_corr(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cc)) != 0)) kw_args--;
+        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_taus)) != 0)) kw_args--;
+        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, 41, __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, 41, __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("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(0, 41, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(0, 41, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } 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_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_PY_LONG_LONG(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+    __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("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 41, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_32c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_2c_corr_all(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_32c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
+static PyObject *__pyx_pf_6c_corr_2c_corr_all(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;
-  Py_ssize_t __pyx_v_p;
+  CYTHON_UNUSED PyTypeObject *__pyx_v_ndarray = 0;
+  CYTHON_UNUSED Py_ssize_t __pyx_v_itemsize;
+  PyObject *__pyx_v_arg = 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
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
+  int __pyx_t_4;
   Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
+  PyObject *__pyx_t_6 = NULL;
   Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  PY_LONG_LONG __pyx_t_10;
-  int __pyx_t_11;
+  int __pyx_t_8;
+  int __pyx_t_9;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
   PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_3_3c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
-
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- */
-  __pyx_v_index = 0;
-
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
- */
-  __pyx_v_corr_val = 0.0;
-
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
- */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
-
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- */
-    __pyx_v_corr_val = 1.0;
-
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
-
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((PY_LONG_LONG *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((PY_LONG_LONG *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((PY_LONG_LONG *) ( /* dim=1 */ ((char *) (((PY_LONG_LONG *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
+  Py_ssize_t __pyx_t_13;
+  Py_ssize_t __pyx_t_14;
+  Py_ssize_t __pyx_t_15;
+  int __pyx_t_16;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("c_corr_all", 0);
+  __Pyx_INCREF(__pyx_v_kwargs);
+  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __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, 41, __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, 41, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_v_itemsize = -1L;
+  if (unlikely(__pyx_v_args == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
+    __PYX_ERR(0, 41, __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, 41, __pyx_L1_error)
+  __pyx_t_2 = ((1 < __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, 41, __pyx_L1_error)
     }
-
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+    __pyx_t_1 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 1);
+    __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, 41, __pyx_L1_error)
+  }
+  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_max_tdoa, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 41, __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, 41, __pyx_L1_error)
+    }
+    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_max_tdoa); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __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, 41, __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, 41, __pyx_L1_error)
+    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_INCREF(__pyx_int_3);
+    __Pyx_GIVEREF(__pyx_int_3);
+    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_3);
+    __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, 41, __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, 41, __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, 41, __pyx_L1_error)
+  }
+  __pyx_L6:;
+  while (1) {
+    __pyx_t_3 = PyInt_Check(__pyx_v_arg); 
+    __pyx_t_4 = (__pyx_t_3 != 0);
+    if (!__pyx_t_4) {
+    } else {
+      __pyx_t_2 = __pyx_t_4;
+      goto __pyx_L12_bool_binop_done;
+    }
+    __pyx_t_4 = PyLong_Check(__pyx_v_arg); 
+    __pyx_t_3 = (__pyx_t_4 != 0);
+    __pyx_t_2 = __pyx_t_3;
+    __pyx_L12_bool_binop_done:;
+    __pyx_t_3 = (__pyx_t_2 != 0);
+    if (__pyx_t_3) {
+      if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 41, __pyx_L1_error)
+      goto __pyx_L10_break;
+    }
+    if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 41, __pyx_L1_error)
+    goto __pyx_L10_break;
+  }
+  __pyx_L10_break:;
+  __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __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, 41, __pyx_L1_error)
+  }
+  __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __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_9 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_7, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_8);
+    if (unlikely(__pyx_t_9 == 0)) break;
+    if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 41, __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_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 41, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __pyx_t_12 = NULL;
+    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
+      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
+      if (likely(__pyx_t_12)) {
+        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
+        __Pyx_INCREF(__pyx_t_12);
+        __Pyx_INCREF(function);
+        __Pyx_DECREF_SET(__pyx_t_11, function);
+      }
+    }
+    __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_kp_s_) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_kp_s_);
+    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 41, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_split); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 41, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_10 = NULL;
+    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
+      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
+      if (likely(__pyx_t_10)) {
+        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
+        __Pyx_INCREF(__pyx_t_10);
+        __Pyx_INCREF(function);
+        __Pyx_DECREF_SET(__pyx_t_11, function);
+      }
+    }
+    __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_10, __pyx_kp_s__2) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_kp_s__2);
+    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1);
+    __pyx_t_1 = 0;
+    __pyx_t_13 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 41, __pyx_L1_error)
+    __pyx_t_14 = __pyx_t_13;
+    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
+      __pyx_v_i = __pyx_t_15;
+      __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, 41, __pyx_L1_error)
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_11 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 41, __pyx_L1_error)
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 41, __pyx_L1_error)
+        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+        if (__pyx_t_2) {
+          __pyx_v_match_found = 1;
+          goto __pyx_L19;
+        }
+        /*else*/ {
+          __pyx_v_match_found = 0;
+          goto __pyx_L17_break;
+        }
+        __pyx_L19:;
+      }
+    }
+    __pyx_L17_break:;
+    __pyx_t_2 = (__pyx_v_match_found != 0);
+    if (__pyx_t_2) {
+      __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 41, __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, 41, __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, 41, __pyx_L1_error)
+  }
+  __pyx_t_7 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 41, __pyx_L1_error)
+  __pyx_t_3 = ((__pyx_t_7 > 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, 41, __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, 41, __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, 41, __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, 41, __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_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_XDECREF(__pyx_t_12);
+  __Pyx_AddTraceback("c_corr.__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_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_6c_corr_39__pyx_fuse_0c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_6c_corr_3c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_fuse_0__pyx_f_6c_corr_c_corr_all(PyObject *__pyx_v_cc, short __pyx_v_max_tdoa, short __pyx_v_base_tdoa, CYTHON_UNUSED int __pyx_skip_dispatch) {
+  __Pyx_memviewslice __pyx_v_cc_mem = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_corr_val;
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_6;
+  PyObject *__pyx_t_7 = NULL;
+  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  long __pyx_t_9;
+  long __pyx_t_10;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_0c_corr_all", 0);
+
+  /* "c_corr.pyx":42
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)             # <<<<<<<<<<<<<<
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ */
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = NULL;
+  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+    if (likely(__pyx_t_3)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+      __Pyx_INCREF(__pyx_t_3);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_2, function);
+    }
+  }
+  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(__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_cc_mem = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
+
+  /* "c_corr.pyx":43
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ */
+  __pyx_v_corr_val = 0.0;
+
+  /* "c_corr.pyx":44
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)             # <<<<<<<<<<<<<<
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ */
+  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = NULL;
+  __pyx_t_6 = 0;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
+    if (likely(__pyx_t_2)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+      __Pyx_INCREF(__pyx_t_2);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_4, function);
+      __pyx_t_6 = 1;
+    }
+  }
+  #if CYTHON_FAST_PYCALL
+  if (PyFunction_Check(__pyx_t_4)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  } else
+  #endif
+  #if CYTHON_FAST_PYCCALL
+  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  } else
+  #endif
+  {
+    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_7);
+    if (__pyx_t_2) {
+      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
+    }
+    __Pyx_GIVEREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
+    __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
+    __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
+    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)(&PyInt_Type)));
+    __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_taus = __pyx_t_8;
+  __pyx_t_8.memview = NULL;
+  __pyx_t_8.data = NULL;
+
+  /* "c_corr.pyx":45
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)             # <<<<<<<<<<<<<<
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ */
+  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = NULL;
+  __pyx_t_6 = 0;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
+    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
+    if (likely(__pyx_t_4)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+      __Pyx_INCREF(__pyx_t_4);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_7, function);
+      __pyx_t_6 = 1;
+    }
+  }
+  #if CYTHON_FAST_PYCALL
+  if (PyFunction_Check(__pyx_t_7)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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;
+  } else
+  #endif
+  #if CYTHON_FAST_PYCCALL
+  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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;
+  } else
+  #endif
+  {
+    __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__pyx_t_4) {
+      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
+    }
+    __Pyx_GIVEREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_3);
+    __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
+    __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
+    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, ((PyObject *)(&PyInt_Type)));
+    __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_out_taus = __pyx_t_8;
+  __pyx_t_8.memview = NULL;
+  __pyx_t_8.data = NULL;
+
+  /* "c_corr.pyx":47
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])             # <<<<<<<<<<<<<<
+ *     return np.log10(corr_val), out_taus
+ * 
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "c_corr.pyx":46
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,             # <<<<<<<<<<<<<<
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ *     return np.log10(corr_val), out_taus
+ */
+  __pyx_v_corr_val = __pyx_f_6c_corr__c_corr_core(__pyx_v_cc_mem, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_corr_val, (((long)__pyx_v_base_tdoa) - 1), ((long)__pyx_v_base_tdoa), ((long)__pyx_v_max_tdoa), ((long)__pyx_t_9), ((long)__pyx_t_10));
+
+  /* "c_corr.pyx":48
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ *     return np.log10(corr_val), out_taus             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_log10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_corr_val); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_3 = NULL;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+    if (likely(__pyx_t_3)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+      __Pyx_INCREF(__pyx_t_3);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_2, function);
+    }
+  }
+  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_out_taus, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
+  __pyx_t_1 = 0;
+  __pyx_t_2 = 0;
+  __pyx_r = __pyx_t_7;
+  __pyx_t_7 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":41
+ * @cython.wraparound(False)
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):             # <<<<<<<<<<<<<<
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ */
+
+  /* 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_XDECREF(__pyx_t_7);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
+  __Pyx_AddTraceback("c_corr.c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc_mem, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6c_corr_39__pyx_fuse_0c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_0__pyx_mdef_6c_corr_39__pyx_fuse_0c_corr_all = {"__pyx_fuse_0c_corr_all", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6c_corr_39__pyx_fuse_0c_corr_all, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_2c_corr_all};
+static PyObject *__pyx_pw_6c_corr_39__pyx_fuse_0c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_cc = 0;
+  short __pyx_v_max_tdoa;
+  short __pyx_v_base_tdoa;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__pyx_fuse_0c_corr_all (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_max_tdoa,&__pyx_n_s_base_tdoa,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_cc)) != 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_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0c_corr_all", 1, 3, 3, 1); __PYX_ERR(0, 41, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0c_corr_all", 1, 3, 3, 2); __PYX_ERR(0, 41, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_0c_corr_all") < 0)) __PYX_ERR(0, 41, __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_cc = values[0];
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_short(values[1]); if (unlikely((__pyx_v_max_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
+    __pyx_v_base_tdoa = __Pyx_PyInt_As_short(values[2]); if (unlikely((__pyx_v_base_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0c_corr_all", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 41, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr.__pyx_fuse_0c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_38__pyx_fuse_0c_corr_all(__pyx_self, __pyx_v_cc, __pyx_v_max_tdoa, __pyx_v_base_tdoa);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_38__pyx_fuse_0c_corr_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cc, short __pyx_v_max_tdoa, short __pyx_v_base_tdoa) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_0c_corr_all", 0);
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __pyx_fuse_0__pyx_f_6c_corr_c_corr_all(__pyx_v_cc, __pyx_v_max_tdoa, __pyx_v_base_tdoa, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __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("c_corr.__pyx_fuse_0c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pw_6c_corr_41__pyx_fuse_1c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_6c_corr_3c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_fuse_1__pyx_f_6c_corr_c_corr_all(PyObject *__pyx_v_cc, int __pyx_v_max_tdoa, int __pyx_v_base_tdoa, CYTHON_UNUSED int __pyx_skip_dispatch) {
+  __Pyx_memviewslice __pyx_v_cc_mem = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_corr_val;
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_6;
+  PyObject *__pyx_t_7 = NULL;
+  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  long __pyx_t_9;
+  long __pyx_t_10;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_1c_corr_all", 0);
+
+  /* "c_corr.pyx":42
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)             # <<<<<<<<<<<<<<
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ */
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = NULL;
+  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+    if (likely(__pyx_t_3)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+      __Pyx_INCREF(__pyx_t_3);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_2, function);
+    }
+  }
+  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(__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_cc_mem = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
+
+  /* "c_corr.pyx":43
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ */
+  __pyx_v_corr_val = 0.0;
+
+  /* "c_corr.pyx":44
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)             # <<<<<<<<<<<<<<
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ */
+  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = NULL;
+  __pyx_t_6 = 0;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
+    if (likely(__pyx_t_2)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+      __Pyx_INCREF(__pyx_t_2);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_4, function);
+      __pyx_t_6 = 1;
+    }
+  }
+  #if CYTHON_FAST_PYCALL
+  if (PyFunction_Check(__pyx_t_4)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  } else
+  #endif
+  #if CYTHON_FAST_PYCCALL
+  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  } else
+  #endif
+  {
+    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_7);
+    if (__pyx_t_2) {
+      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
+    }
+    __Pyx_GIVEREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
+    __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
+    __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
+    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)(&PyInt_Type)));
+    __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_taus = __pyx_t_8;
+  __pyx_t_8.memview = NULL;
+  __pyx_t_8.data = NULL;
+
+  /* "c_corr.pyx":45
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)             # <<<<<<<<<<<<<<
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ */
+  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = NULL;
+  __pyx_t_6 = 0;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
+    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
+    if (likely(__pyx_t_4)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+      __Pyx_INCREF(__pyx_t_4);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_7, function);
+      __pyx_t_6 = 1;
+    }
+  }
+  #if CYTHON_FAST_PYCALL
+  if (PyFunction_Check(__pyx_t_7)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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;
+  } else
+  #endif
+  #if CYTHON_FAST_PYCCALL
+  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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;
+  } else
+  #endif
+  {
+    __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__pyx_t_4) {
+      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
+    }
+    __Pyx_GIVEREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_3);
+    __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
+    __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
+    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, ((PyObject *)(&PyInt_Type)));
+    __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_out_taus = __pyx_t_8;
+  __pyx_t_8.memview = NULL;
+  __pyx_t_8.data = NULL;
+
+  /* "c_corr.pyx":47
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])             # <<<<<<<<<<<<<<
+ *     return np.log10(corr_val), out_taus
+ * 
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "c_corr.pyx":46
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,             # <<<<<<<<<<<<<<
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ *     return np.log10(corr_val), out_taus
+ */
+  __pyx_v_corr_val = __pyx_f_6c_corr__c_corr_core(__pyx_v_cc_mem, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_corr_val, (((long)__pyx_v_base_tdoa) - 1), ((long)__pyx_v_base_tdoa), ((long)__pyx_v_max_tdoa), ((long)__pyx_t_9), ((long)__pyx_t_10));
+
+  /* "c_corr.pyx":48
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ *     return np.log10(corr_val), out_taus             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_log10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_corr_val); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_3 = NULL;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+    if (likely(__pyx_t_3)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+      __Pyx_INCREF(__pyx_t_3);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_2, function);
+    }
+  }
+  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_out_taus, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
+  __pyx_t_1 = 0;
+  __pyx_t_2 = 0;
+  __pyx_r = __pyx_t_7;
+  __pyx_t_7 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":41
+ * @cython.wraparound(False)
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):             # <<<<<<<<<<<<<<
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ */
+
+  /* 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_XDECREF(__pyx_t_7);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
+  __Pyx_AddTraceback("c_corr.c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc_mem, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6c_corr_41__pyx_fuse_1c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_1__pyx_mdef_6c_corr_41__pyx_fuse_1c_corr_all = {"__pyx_fuse_1c_corr_all", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6c_corr_41__pyx_fuse_1c_corr_all, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_2c_corr_all};
+static PyObject *__pyx_pw_6c_corr_41__pyx_fuse_1c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_cc = 0;
+  int __pyx_v_max_tdoa;
+  int __pyx_v_base_tdoa;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__pyx_fuse_1c_corr_all (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_max_tdoa,&__pyx_n_s_base_tdoa,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_cc)) != 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_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1c_corr_all", 1, 3, 3, 1); __PYX_ERR(0, 41, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1c_corr_all", 1, 3, 3, 2); __PYX_ERR(0, 41, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_1c_corr_all") < 0)) __PYX_ERR(0, 41, __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_cc = values[0];
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_max_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
+    __pyx_v_base_tdoa = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_base_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1c_corr_all", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 41, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr.__pyx_fuse_1c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_40__pyx_fuse_1c_corr_all(__pyx_self, __pyx_v_cc, __pyx_v_max_tdoa, __pyx_v_base_tdoa);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_40__pyx_fuse_1c_corr_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cc, int __pyx_v_max_tdoa, int __pyx_v_base_tdoa) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_1c_corr_all", 0);
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __pyx_fuse_1__pyx_f_6c_corr_c_corr_all(__pyx_v_cc, __pyx_v_max_tdoa, __pyx_v_base_tdoa, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __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("c_corr.__pyx_fuse_1c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pw_6c_corr_43__pyx_fuse_2c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_6c_corr_3c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_fuse_2__pyx_f_6c_corr_c_corr_all(PyObject *__pyx_v_cc, long __pyx_v_max_tdoa, long __pyx_v_base_tdoa, CYTHON_UNUSED int __pyx_skip_dispatch) {
+  __Pyx_memviewslice __pyx_v_cc_mem = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_corr_val;
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_6;
+  PyObject *__pyx_t_7 = NULL;
+  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  long __pyx_t_9;
+  long __pyx_t_10;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_2c_corr_all", 0);
+
+  /* "c_corr.pyx":42
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)             # <<<<<<<<<<<<<<
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ */
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = NULL;
+  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
+    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+    if (likely(__pyx_t_3)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+      __Pyx_INCREF(__pyx_t_3);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_2, function);
+    }
+  }
+  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(__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_cc_mem = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
+
+  /* "c_corr.pyx":43
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ */
+  __pyx_v_corr_val = 0.0;
+
+  /* "c_corr.pyx":44
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)             # <<<<<<<<<<<<<<
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ */
+  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = NULL;
+  __pyx_t_6 = 0;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
+    if (likely(__pyx_t_2)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+      __Pyx_INCREF(__pyx_t_2);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_4, function);
+      __pyx_t_6 = 1;
+    }
+  }
+  #if CYTHON_FAST_PYCALL
+  if (PyFunction_Check(__pyx_t_4)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  } else
+  #endif
+  #if CYTHON_FAST_PYCCALL
+  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  } else
+  #endif
+  {
+    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_7);
+    if (__pyx_t_2) {
+      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
+    }
+    __Pyx_GIVEREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
+    __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
+    __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
+    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)(&PyInt_Type)));
+    __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_taus = __pyx_t_8;
+  __pyx_t_8.memview = NULL;
+  __pyx_t_8.data = NULL;
+
+  /* "c_corr.pyx":45
+ *     cdef double corr_val = 0.0
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)             # <<<<<<<<<<<<<<
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ */
+  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = NULL;
+  __pyx_t_6 = 0;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
+    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
+    if (likely(__pyx_t_4)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+      __Pyx_INCREF(__pyx_t_4);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_7, function);
+      __pyx_t_6 = 1;
+    }
+  }
+  #if CYTHON_FAST_PYCALL
+  if (PyFunction_Check(__pyx_t_7)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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;
+  } else
+  #endif
+  #if CYTHON_FAST_PYCCALL
+  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
+    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)(&PyInt_Type))};
+    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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;
+  } else
+  #endif
+  {
+    __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__pyx_t_4) {
+      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
+    }
+    __Pyx_GIVEREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_3);
+    __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
+    __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
+    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, ((PyObject *)(&PyInt_Type)));
+    __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 45, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_out_taus = __pyx_t_8;
+  __pyx_t_8.memview = NULL;
+  __pyx_t_8.data = NULL;
+
+  /* "c_corr.pyx":47
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])             # <<<<<<<<<<<<<<
+ *     return np.log10(corr_val), out_taus
+ * 
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cc, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "c_corr.pyx":46
+ *     cdef long[::1] taus = np.zeros(cc.shape[0], int)
+ *     cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,             # <<<<<<<<<<<<<<
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ *     return np.log10(corr_val), out_taus
+ */
+  __pyx_v_corr_val = __pyx_f_6c_corr__c_corr_core(__pyx_v_cc_mem, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_corr_val, (((long)__pyx_v_base_tdoa) - 1), ((long)__pyx_v_base_tdoa), ((long)__pyx_v_max_tdoa), ((long)__pyx_t_9), ((long)__pyx_t_10));
+
+  /* "c_corr.pyx":48
+ *     corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+ *                             <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
+ *     return np.log10(corr_val), out_taus             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_log10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_corr_val); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_3 = NULL;
+  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
+    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+    if (likely(__pyx_t_3)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+      __Pyx_INCREF(__pyx_t_3);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_2, function);
+    }
+  }
+  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_out_taus, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
+  __pyx_t_1 = 0;
+  __pyx_t_2 = 0;
+  __pyx_r = __pyx_t_7;
+  __pyx_t_7 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":41
+ * @cython.wraparound(False)
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):             # <<<<<<<<<<<<<<
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ */
+
+  /* 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_XDECREF(__pyx_t_7);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
+  __Pyx_AddTraceback("c_corr.c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc_mem, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6c_corr_43__pyx_fuse_2c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_2__pyx_mdef_6c_corr_43__pyx_fuse_2c_corr_all = {"__pyx_fuse_2c_corr_all", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6c_corr_43__pyx_fuse_2c_corr_all, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6c_corr_2c_corr_all};
+static PyObject *__pyx_pw_6c_corr_43__pyx_fuse_2c_corr_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_cc = 0;
+  long __pyx_v_max_tdoa;
+  long __pyx_v_base_tdoa;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__pyx_fuse_2c_corr_all (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_max_tdoa,&__pyx_n_s_base_tdoa,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_cc)) != 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_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2c_corr_all", 1, 3, 3, 1); __PYX_ERR(0, 41, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2c_corr_all", 1, 3, 3, 2); __PYX_ERR(0, 41, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_2c_corr_all") < 0)) __PYX_ERR(0, 41, __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_cc = values[0];
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_max_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
+    __pyx_v_base_tdoa = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_base_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2c_corr_all", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 41, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr.__pyx_fuse_2c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_42__pyx_fuse_2c_corr_all(__pyx_self, __pyx_v_cc, __pyx_v_max_tdoa, __pyx_v_base_tdoa);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_42__pyx_fuse_2c_corr_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cc, long __pyx_v_max_tdoa, long __pyx_v_base_tdoa) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_2c_corr_all", 0);
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __pyx_fuse_2__pyx_f_6c_corr_c_corr_all(__pyx_v_cc, __pyx_v_max_tdoa, __pyx_v_base_tdoa, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __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("c_corr.__pyx_fuse_2c_corr_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "c_corr.pyx":51
+ * 
+ * 
+ * cdef long moduloNeg(long a, long b):             # <<<<<<<<<<<<<<
+ *     if a < 0:
+ *         return a + b
+ */
+
+static long __pyx_f_6c_corr_moduloNeg(long __pyx_v_a, long __pyx_v_b) {
+  long __pyx_r;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  __Pyx_RefNannySetupContext("moduloNeg", 0);
+
+  /* "c_corr.pyx":52
+ * 
+ * cdef long moduloNeg(long a, long b):
+ *     if a < 0:             # <<<<<<<<<<<<<<
+ *         return a + b
+ *     else:
+ */
+  __pyx_t_1 = ((__pyx_v_a < 0) != 0);
+  if (__pyx_t_1) {
+
+    /* "c_corr.pyx":53
+ * cdef long moduloNeg(long a, long b):
+ *     if a < 0:
+ *         return a + b             # <<<<<<<<<<<<<<
+ *     else:
+ *         return a
+ */
+    __pyx_r = (__pyx_v_a + __pyx_v_b);
+    goto __pyx_L0;
+
+    /* "c_corr.pyx":52
+ * 
+ * cdef long moduloNeg(long a, long b):
+ *     if a < 0:             # <<<<<<<<<<<<<<
+ *         return a + b
+ *     else:
+ */
+  }
+
+  /* "c_corr.pyx":55
+ *         return a + b
+ *     else:
+ *         return a             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  /*else*/ {
+    __pyx_r = __pyx_v_a;
+    goto __pyx_L0;
+  }
+
+  /* "c_corr.pyx":51
+ * 
+ * 
+ * cdef long moduloNeg(long a, long b):             # <<<<<<<<<<<<<<
+ *     if a < 0:
+ *         return a + b
+ */
+
+  /* function exit code */
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "c_corr.pyx":61
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * cdef double _c_corr_core(float[:,::1] cc, long[::1] taus, long[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  long curr_tdoa, long ind_tdoa, long max_tdoa, long win_size, long n_pair):
+ *     cdef int i0 = 1
+ */
+
+static double __pyx_f_6c_corr__c_corr_core(__Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_low;
+  int __pyx_v_high;
+  long __pyx_v_t;
+  double __pyx_r;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  long __pyx_t_2;
+  long __pyx_t_3;
+  long __pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  Py_ssize_t __pyx_t_7;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("_c_corr_core", 0);
+  __Pyx_TraceCall("_c_corr_core", __pyx_f[0], 61, 0, __PYX_ERR(0, 61, __pyx_L1_error));
+
+  /* "c_corr.pyx":63
+ * cdef double _c_corr_core(float[:,::1] cc, long[::1] taus, long[::1] out_taus, double val,
+ *                  long curr_tdoa, long ind_tdoa, long max_tdoa, long win_size, long n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":64
+ *                  long curr_tdoa, long ind_tdoa, long max_tdoa, long win_size, long n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     if curr_tdoa < 0:
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":65
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     if curr_tdoa < 0:
+ *         for i in range(ind_tdoa, n_pair):
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":66
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     if curr_tdoa < 0:             # <<<<<<<<<<<<<<
+ *         for i in range(ind_tdoa, n_pair):
+ *             taus[i] = taus[i0] - taus[j0]
+ */
+  __pyx_t_1 = ((__pyx_v_curr_tdoa < 0) != 0);
+  if (__pyx_t_1) {
+
+    /* "c_corr.pyx":67
+ *     cdef double tmp_val = 0.0
+ *     if curr_tdoa < 0:
+ *         for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *             taus[i] = taus[i0] - taus[j0]
+ *             i0 += 1
+ */
+    __pyx_t_2 = __pyx_v_n_pair;
+    __pyx_t_3 = __pyx_t_2;
+    for (__pyx_t_4 = __pyx_v_ind_tdoa; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+      __pyx_v_i = __pyx_t_4;
+
+      /* "c_corr.pyx":68
+ *     if curr_tdoa < 0:
+ *         for i in range(ind_tdoa, n_pair):
+ *             taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *             i0 += 1
+ *             if i0 >= ind_tdoa:
+ */
+      __pyx_t_5 = __pyx_v_i0;
+      __pyx_t_6 = __pyx_v_j0;
+      __pyx_t_7 = __pyx_v_i;
+      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) )) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_5)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_6)) ))));
+
+      /* "c_corr.pyx":69
+ *         for i in range(ind_tdoa, n_pair):
+ *             taus[i] = taus[i0] - taus[j0]
+ *             i0 += 1             # <<<<<<<<<<<<<<
+ *             if i0 >= ind_tdoa:
+ *                 j0 += 1
+ */
+      __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+      /* "c_corr.pyx":70
+ *             taus[i] = taus[i0] - taus[j0]
+ *             i0 += 1
+ *             if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                 j0 += 1
+ *                 i0 = j0 + 1
+ */
+      __pyx_t_1 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+      if (__pyx_t_1) {
+
+        /* "c_corr.pyx":71
+ *             i0 += 1
+ *             if i0 >= ind_tdoa:
+ *                 j0 += 1             # <<<<<<<<<<<<<<
+ *                 i0 = j0 + 1
+ *         tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+        __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+        /* "c_corr.pyx":72
+ *             if i0 >= ind_tdoa:
+ *                 j0 += 1
+ *                 i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *         tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *         for i in range(1, n_pair):
+ */
+        __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+        /* "c_corr.pyx":70
+ *             taus[i] = taus[i0] - taus[j0]
+ *             i0 += 1
+ *             if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                 j0 += 1
+ *                 i0 = j0 + 1
+ */
+      }
+    }
+
+    /* "c_corr.pyx":73
+ *                 j0 += 1
+ *                 i0 = j0 + 1
+ *         tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *         for i in range(1, n_pair):
+ *             tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+    __pyx_t_6 = 0;
+    __pyx_t_5 = 0;
+    __pyx_t_7 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_6)) ))), __pyx_v_win_size);
+    __pyx_v_tmp_val = (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_5 * __pyx_v_cc.strides[0]) )) + __pyx_t_7)) )));
+
+    /* "c_corr.pyx":74
+ *                 i0 = j0 + 1
+ *         tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *         for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *             tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *         if val < tmp_val:
+ */
+    __pyx_t_2 = __pyx_v_n_pair;
+    __pyx_t_3 = __pyx_t_2;
+    for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+      __pyx_v_i = __pyx_t_4;
+
+      /* "c_corr.pyx":75
+ *         tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *         for i in range(1, n_pair):
+ *             tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *         if val < tmp_val:
+ *             val = tmp_val
+ */
+      __pyx_t_6 = __pyx_v_i;
+      __pyx_t_7 = __pyx_v_i;
+      __pyx_t_5 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_6)) ))), __pyx_v_win_size);
+      __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_7 * __pyx_v_cc.strides[0]) )) + __pyx_t_5)) ))));
+    }
+
+    /* "c_corr.pyx":76
+ *         for i in range(1, n_pair):
+ *             tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *         if val < tmp_val:             # <<<<<<<<<<<<<<
+ *             val = tmp_val
+ *             out_taus[:] = taus
+ */
+    __pyx_t_1 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+    if (__pyx_t_1) {
+
+      /* "c_corr.pyx":77
+ *             tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *         if val < tmp_val:
+ *             val = tmp_val             # <<<<<<<<<<<<<<
+ *             out_taus[:] = taus
+ *         return val
+ */
+      __pyx_v_val = __pyx_v_tmp_val;
+
+      /* "c_corr.pyx":78
+ *         if val < tmp_val:
+ *             val = tmp_val
+ *             out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *         return val
+ *     cdef int low = -max_tdoa
+ */
+      if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 78, __pyx_L1_error)
+
+      /* "c_corr.pyx":76
+ *         for i in range(1, n_pair):
+ *             tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *         if val < tmp_val:             # <<<<<<<<<<<<<<
+ *             val = tmp_val
+ *             out_taus[:] = taus
+ */
+    }
+
+    /* "c_corr.pyx":79
+ *             val = tmp_val
+ *             out_taus[:] = taus
+ *         return val             # <<<<<<<<<<<<<<
+ *     cdef int low = -max_tdoa
+ *     cdef int high = max_tdoa
+ */
+    __pyx_r = __pyx_v_val;
+    goto __pyx_L0;
+
+    /* "c_corr.pyx":66
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     if curr_tdoa < 0:             # <<<<<<<<<<<<<<
+ *         for i in range(ind_tdoa, n_pair):
+ *             taus[i] = taus[i0] - taus[j0]
+ */
+  }
+
+  /* "c_corr.pyx":80
+ *             out_taus[:] = taus
+ *         return val
+ *     cdef int low = -max_tdoa             # <<<<<<<<<<<<<<
+ *     cdef int high = max_tdoa
+ *     for i in range(curr_tdoa+1, ind_tdoa):
+ */
+  __pyx_v_low = (-__pyx_v_max_tdoa);
+
+  /* "c_corr.pyx":81
+ *         return val
+ *     cdef int low = -max_tdoa
+ *     cdef int high = max_tdoa             # <<<<<<<<<<<<<<
+ *     for i in range(curr_tdoa+1, ind_tdoa):
+ *         if low < taus[i] - max_tdoa:
+ */
+  __pyx_v_high = __pyx_v_max_tdoa;
+
+  /* "c_corr.pyx":82
+ *     cdef int low = -max_tdoa
+ *     cdef int high = max_tdoa
+ *     for i in range(curr_tdoa+1, ind_tdoa):             # <<<<<<<<<<<<<<
+ *         if low < taus[i] - max_tdoa:
+ *             low = -max_tdoa + taus[i]
+ */
+  __pyx_t_2 = __pyx_v_ind_tdoa;
+  __pyx_t_3 = __pyx_t_2;
+  for (__pyx_t_4 = (__pyx_v_curr_tdoa + 1); __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+    __pyx_v_i = __pyx_t_4;
+
+    /* "c_corr.pyx":83
+ *     cdef int high = max_tdoa
+ *     for i in range(curr_tdoa+1, ind_tdoa):
+ *         if low < taus[i] - max_tdoa:             # <<<<<<<<<<<<<<
+ *             low = -max_tdoa + taus[i]
+ *         if high > max_tdoa + taus[i]:
+ */
+    __pyx_t_6 = __pyx_v_i;
+    __pyx_t_1 = ((__pyx_v_low < ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_6)) ))) - __pyx_v_max_tdoa)) != 0);
+    if (__pyx_t_1) {
+
+      /* "c_corr.pyx":84
+ *     for i in range(curr_tdoa+1, ind_tdoa):
+ *         if low < taus[i] - max_tdoa:
+ *             low = -max_tdoa + taus[i]             # <<<<<<<<<<<<<<
+ *         if high > max_tdoa + taus[i]:
+ *             high = max_tdoa + taus[i]
+ */
+      __pyx_t_6 = __pyx_v_i;
+      __pyx_v_low = ((-__pyx_v_max_tdoa) + (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_6)) ))));
+
+      /* "c_corr.pyx":83
+ *     cdef int high = max_tdoa
+ *     for i in range(curr_tdoa+1, ind_tdoa):
+ *         if low < taus[i] - max_tdoa:             # <<<<<<<<<<<<<<
+ *             low = -max_tdoa + taus[i]
+ *         if high > max_tdoa + taus[i]:
+ */
+    }
+
+    /* "c_corr.pyx":85
+ *         if low < taus[i] - max_tdoa:
+ *             low = -max_tdoa + taus[i]
+ *         if high > max_tdoa + taus[i]:             # <<<<<<<<<<<<<<
+ *             high = max_tdoa + taus[i]
+ *     for t in range(low, high+1):
+ */
+    __pyx_t_6 = __pyx_v_i;
+    __pyx_t_1 = ((__pyx_v_high > (__pyx_v_max_tdoa + (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_6)) ))))) != 0);
+    if (__pyx_t_1) {
+
+      /* "c_corr.pyx":86
+ *             low = -max_tdoa + taus[i]
+ *         if high > max_tdoa + taus[i]:
+ *             high = max_tdoa + taus[i]             # <<<<<<<<<<<<<<
+ *     for t in range(low, high+1):
+ *         taus[curr_tdoa] = t
+ */
+      __pyx_t_6 = __pyx_v_i;
+      __pyx_v_high = (__pyx_v_max_tdoa + (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_6)) ))));
+
+      /* "c_corr.pyx":85
+ *         if low < taus[i] - max_tdoa:
+ *             low = -max_tdoa + taus[i]
+ *         if high > max_tdoa + taus[i]:             # <<<<<<<<<<<<<<
+ *             high = max_tdoa + taus[i]
+ *     for t in range(low, high+1):
+ */
+    }
+  }
+
+  /* "c_corr.pyx":87
+ *         if high > max_tdoa + taus[i]:
+ *             high = max_tdoa + taus[i]
+ *     for t in range(low, high+1):             # <<<<<<<<<<<<<<
+ *         taus[curr_tdoa] = t
+ *         val = _c_corr_core(cc, taus, out_taus, val, curr_tdoa-1, ind_tdoa, max_tdoa, win_size, n_pair)
+ */
+  __pyx_t_2 = (__pyx_v_high + 1);
+  __pyx_t_3 = __pyx_t_2;
+  for (__pyx_t_4 = __pyx_v_low; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+    __pyx_v_t = __pyx_t_4;
+
+    /* "c_corr.pyx":88
+ *             high = max_tdoa + taus[i]
+ *     for t in range(low, high+1):
+ *         taus[curr_tdoa] = t             # <<<<<<<<<<<<<<
+ *         val = _c_corr_core(cc, taus, out_taus, val, curr_tdoa-1, ind_tdoa, max_tdoa, win_size, n_pair)
+ *     return val
+ */
+    __pyx_t_6 = __pyx_v_curr_tdoa;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_6)) )) = __pyx_v_t;
+
+    /* "c_corr.pyx":89
+ *     for t in range(low, high+1):
+ *         taus[curr_tdoa] = t
+ *         val = _c_corr_core(cc, taus, out_taus, val, curr_tdoa-1, ind_tdoa, max_tdoa, win_size, n_pair)             # <<<<<<<<<<<<<<
+ *     return val
+ * 
+ */
+    __pyx_v_val = __pyx_f_6c_corr__c_corr_core(__pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, (__pyx_v_curr_tdoa - 1), __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
+  }
+
+  /* "c_corr.pyx":90
+ *         taus[curr_tdoa] = t
+ *         val = _c_corr_core(cc, taus, out_taus, val, curr_tdoa-1, ind_tdoa, max_tdoa, win_size, n_pair)
+ *     return val             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __pyx_r = __pyx_v_val;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":61
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * cdef double _c_corr_core(float[:,::1] cc, long[::1] taus, long[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  long curr_tdoa, long ind_tdoa, long max_tdoa, long win_size, long n_pair):
+ *     cdef int i0 = 1
+ */
+
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_WriteUnraisable("c_corr._c_corr_core", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_TraceReturn(Py_None, 0);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6c_corr_5_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_6c_corr_5_c_corr_core2 = {"_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6c_corr_5_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_6c_corr_5_c_corr_core2(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;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 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, 96, __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, 96, __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, 96, __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, 96, __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, 96, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_4_c_corr_core2(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_4_c_corr_core2(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_short_is_signed;
+  int __pyx_v_int_is_signed;
+  int __pyx_v_long_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_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  long __pyx_t_7;
+  __Pyx_memviewslice __pyx_t_8;
+  Py_ssize_t __pyx_t_9;
+  int __pyx_t_10;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
+  PyObject *__pyx_t_13 = NULL;
+  PyObject *__pyx_t_14 = NULL;
+  Py_ssize_t __pyx_t_15;
+  Py_ssize_t __pyx_t_16;
+  Py_ssize_t __pyx_t_17;
+  int __pyx_t_18;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("_c_corr_core2", 0);
+  __Pyx_TraceCall("_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+  __Pyx_INCREF(__pyx_v_kwargs);
+  __pyx_t_1 = PyList_New(1 * 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  { Py_ssize_t __pyx_temp;
+    for (__pyx_temp=0; __pyx_temp < 2; __pyx_temp++) {
+      __Pyx_INCREF(Py_None);
+      __Pyx_GIVEREF(Py_None);
+      PyList_SET_ITEM(__pyx_t_1, __pyx_temp, 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, 96, __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, 96, __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_short_is_signed = (!((((short)-1L) > 0) != 0));
+  __pyx_v_int_is_signed = (!((((int)-1L) > 0) != 0));
+  __pyx_v_long_is_signed = (!((((long)-1L) > 0) != 0));
+  if (unlikely(__pyx_v_args == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
+    __PYX_ERR(0, 96, __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, 96, __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, 96, __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, 96, __pyx_L1_error)
+  }
+  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_cc, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 96, __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, 96, __pyx_L1_error)
+    }
+    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_cc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __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, 96, __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, 96, __pyx_L1_error)
+    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_INCREF(__pyx_int_9);
+    __Pyx_GIVEREF(__pyx_int_9);
+    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_9);
+    __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, 96, __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, 96, __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, 96, __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, 96, __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, 96, __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, 96, __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, 96, __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, 96, __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, 96, __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, 96, __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(short)) == __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, 96, __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, 96, __pyx_L1_error)
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
+          if (__pyx_t_2) {
+          } else {
+            __pyx_t_3 = __pyx_t_2;
+            goto __pyx_L16_bool_binop_done;
+          }
+          __pyx_t_2 = ((!((__pyx_v_short_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_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+            goto __pyx_L10_break;
+          }
+          __pyx_t_2 = (((sizeof(int)) == __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, 96, __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, 96, __pyx_L1_error)
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
+          if (__pyx_t_2) {
+          } else {
+            __pyx_t_3 = __pyx_t_2;
+            goto __pyx_L20_bool_binop_done;
+          }
+          __pyx_t_2 = ((!((__pyx_v_int_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_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+            goto __pyx_L10_break;
+          }
+          __pyx_t_2 = (((sizeof(long)) == __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, 96, __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, 96, __pyx_L1_error)
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
+          if (__pyx_t_2) {
+          } else {
+            __pyx_t_3 = __pyx_t_2;
+            goto __pyx_L24_bool_binop_done;
+          }
+          __pyx_t_2 = ((!((__pyx_v_long_is_signed ^ __pyx_v_dtype_signed) != 0)) != 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_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+            goto __pyx_L10_break;
+          }
+          break;
+          case 'f':
+          __pyx_t_2 = (((sizeof(float)) == __pyx_v_itemsize) != 0);
+          if (__pyx_t_2) {
+          } else {
+            __pyx_t_3 = __pyx_t_2;
+            goto __pyx_L28_bool_binop_done;
+          }
+          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __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, 96, __pyx_L1_error)
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
+          __pyx_t_3 = __pyx_t_2;
+          __pyx_L28_bool_binop_done:;
+          if (__pyx_t_3) {
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+            goto __pyx_L10_break;
+          }
+          __pyx_t_2 = (((sizeof(double)) == __pyx_v_itemsize) != 0);
+          if (__pyx_t_2) {
+          } else {
+            __pyx_t_3 = __pyx_t_2;
+            goto __pyx_L31_bool_binop_done;
+          }
+          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __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, 96, __pyx_L1_error)
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
+          __pyx_t_3 = __pyx_t_2;
+          __pyx_L31_bool_binop_done:;
+          if (__pyx_t_3) {
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __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_L34_bool_binop_done;
+    }
+    __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(short))) != 0);
+    __pyx_t_3 = __pyx_t_2;
+    __pyx_L34_bool_binop_done:;
+    if (__pyx_t_3) {
+      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(__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_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __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(int))) != 0);
+    __pyx_t_3 = __pyx_t_2;
+    __pyx_L38_bool_binop_done:;
+    if (__pyx_t_3) {
+      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(__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_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __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(long))) != 0);
+    __pyx_t_3 = __pyx_t_2;
+    __pyx_L42_bool_binop_done:;
+    if (__pyx_t_3) {
+      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(__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_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __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_L46_bool_binop_done;
+    }
+    __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(float))) != 0);
+    __pyx_t_3 = __pyx_t_2;
+    __pyx_L46_bool_binop_done:;
+    if (__pyx_t_3) {
+      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(__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_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __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_L50_bool_binop_done;
+    }
+    __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(double))) != 0);
+    __pyx_t_3 = __pyx_t_2;
+    __pyx_L50_bool_binop_done:;
+    if (__pyx_t_3) {
+      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__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_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __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, 96, __pyx_L1_error)
+    goto __pyx_L10_break;
+  }
+  __pyx_L10_break:;
+  if (unlikely(__pyx_v_args == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
+    __PYX_ERR(0, 96, __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, 96, __pyx_L1_error)
+  __pyx_t_3 = ((1 < __pyx_t_5) != 0);
+  if (__pyx_t_3) {
+    if (unlikely(__pyx_v_args == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+      __PYX_ERR(0, 96, __pyx_L1_error)
+    }
+    __pyx_t_6 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 1);
+    __Pyx_INCREF(__pyx_t_6);
+    __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_6);
+    __pyx_t_6 = 0;
+    goto __pyx_L53;
+  }
+  __pyx_t_2 = (__pyx_v_kwargs != Py_None);
+  __pyx_t_4 = (__pyx_t_2 != 0);
+  if (__pyx_t_4) {
+  } else {
+    __pyx_t_3 = __pyx_t_4;
+    goto __pyx_L54_bool_binop_done;
+  }
+  if (unlikely(__pyx_v_kwargs == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+    __PYX_ERR(0, 96, __pyx_L1_error)
+  }
+  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_taus, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+  __pyx_t_2 = (__pyx_t_4 != 0);
+  __pyx_t_3 = __pyx_t_2;
+  __pyx_L54_bool_binop_done:;
+  if (__pyx_t_3) {
+    if (unlikely(__pyx_v_kwargs == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+      __PYX_ERR(0, 96, __pyx_L1_error)
+    }
+    __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_taus); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_6);
+    __pyx_t_6 = 0;
+    goto __pyx_L53;
+  }
+  /*else*/ {
+    if (unlikely(__pyx_v_args == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
+      __PYX_ERR(0, 96, __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, 96, __pyx_L1_error)
+    __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_INCREF(__pyx_int_9);
+    __Pyx_GIVEREF(__pyx_int_9);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_9);
+    __Pyx_INCREF(__pyx_n_s_s);
+    __Pyx_GIVEREF(__pyx_n_s_s);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_s);
+    __Pyx_GIVEREF(__pyx_t_6);
+    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __PYX_ERR(0, 96, __pyx_L1_error)
+  }
+  __pyx_L53:;
+  while (1) {
+    __pyx_t_3 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None));
+    __pyx_t_2 = (__pyx_t_3 != 0);
+    if (__pyx_t_2) {
+      __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray); 
+      __pyx_t_3 = (__pyx_t_2 != 0);
+      if (__pyx_t_3) {
+        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_1);
+        __pyx_t_1 = 0;
+        goto __pyx_L59;
+      }
+      __pyx_t_3 = __pyx_memoryview_check(__pyx_v_arg); 
+      __pyx_t_2 = (__pyx_t_3 != 0);
+      if (__pyx_t_2) {
+        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_XDECREF_SET(__pyx_v_arg_base, __pyx_t_1);
+        __pyx_t_1 = 0;
+        __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray); 
+        __pyx_t_3 = (__pyx_t_2 != 0);
+        if (__pyx_t_3) {
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+          __Pyx_GOTREF(__pyx_t_1);
+          __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_1);
+          __pyx_t_1 = 0;
+          goto __pyx_L60;
+        }
+        /*else*/ {
+          __Pyx_INCREF(Py_None);
+          __Pyx_XDECREF_SET(__pyx_v_dtype, Py_None);
+        }
+        __pyx_L60:;
+        goto __pyx_L59;
+      }
+      /*else*/ {
+        __Pyx_INCREF(Py_None);
+        __Pyx_XDECREF_SET(__pyx_v_dtype, Py_None);
+      }
+      __pyx_L59:;
+      __pyx_v_itemsize = -1L;
+      __pyx_t_3 = (__pyx_v_dtype != Py_None);
+      __pyx_t_2 = (__pyx_t_3 != 0);
+      if (__pyx_t_2) {
+        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_v_itemsize = __pyx_t_5;
+        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_3 = (((sizeof(short)) == __pyx_v_itemsize) != 0);
+          if (__pyx_t_3) {
+          } else {
+            __pyx_t_2 = __pyx_t_3;
+            goto __pyx_L63_bool_binop_done;
+          }
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
+          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+          __pyx_t_3 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0);
+          if (__pyx_t_3) {
+          } else {
+            __pyx_t_2 = __pyx_t_3;
+            goto __pyx_L63_bool_binop_done;
+          }
+          __pyx_t_3 = ((!((__pyx_v_short_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0);
+          __pyx_t_2 = __pyx_t_3;
+          __pyx_L63_bool_binop_done:;
+          if (__pyx_t_2) {
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+            goto __pyx_L57_break;
+          }
+          __pyx_t_3 = (((sizeof(int)) == __pyx_v_itemsize) != 0);
+          if (__pyx_t_3) {
+          } else {
+            __pyx_t_2 = __pyx_t_3;
+            goto __pyx_L67_bool_binop_done;
+          }
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
+          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+          __pyx_t_3 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0);
+          if (__pyx_t_3) {
+          } else {
+            __pyx_t_2 = __pyx_t_3;
+            goto __pyx_L67_bool_binop_done;
+          }
+          __pyx_t_3 = ((!((__pyx_v_int_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0);
+          __pyx_t_2 = __pyx_t_3;
+          __pyx_L67_bool_binop_done:;
+          if (__pyx_t_2) {
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+            goto __pyx_L57_break;
+          }
+          __pyx_t_3 = (((sizeof(long)) == __pyx_v_itemsize) != 0);
+          if (__pyx_t_3) {
+          } else {
+            __pyx_t_2 = __pyx_t_3;
+            goto __pyx_L71_bool_binop_done;
+          }
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
+          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+          __pyx_t_3 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0);
+          if (__pyx_t_3) {
+          } else {
+            __pyx_t_2 = __pyx_t_3;
+            goto __pyx_L71_bool_binop_done;
+          }
+          __pyx_t_3 = ((!((__pyx_v_long_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0);
+          __pyx_t_2 = __pyx_t_3;
+          __pyx_L71_bool_binop_done:;
+          if (__pyx_t_2) {
+            if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+            goto __pyx_L57_break;
+          }
+          break;
+          case 'f':
+          break;
+          case 'c':
+          break;
+          case 'O':
+          break;
+          default: break;
+        }
+      }
+    }
+    __pyx_t_3 = ((__pyx_v_itemsize == -1L) != 0);
+    if (!__pyx_t_3) {
+    } else {
+      __pyx_t_2 = __pyx_t_3;
+      goto __pyx_L75_bool_binop_done;
+    }
+    __pyx_t_3 = ((__pyx_v_itemsize == (sizeof(short))) != 0);
+    __pyx_t_2 = __pyx_t_3;
+    __pyx_L75_bool_binop_done:;
+    if (__pyx_t_2) {
+      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_short(__pyx_v_arg, 0); 
+      __pyx_v_memslice = __pyx_t_8;
+      __pyx_t_2 = (__pyx_v_memslice.memview != 0);
+      if (__pyx_t_2) {
+        __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); 
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_short, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+        goto __pyx_L57_break;
+      }
+      /*else*/ {
+        PyErr_Clear(); 
+      }
+    }
+    __pyx_t_3 = ((__pyx_v_itemsize == -1L) != 0);
+    if (!__pyx_t_3) {
+    } else {
+      __pyx_t_2 = __pyx_t_3;
+      goto __pyx_L79_bool_binop_done;
+    }
+    __pyx_t_3 = ((__pyx_v_itemsize == (sizeof(int))) != 0);
+    __pyx_t_2 = __pyx_t_3;
+    __pyx_L79_bool_binop_done:;
+    if (__pyx_t_2) {
+      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_int(__pyx_v_arg, 0); 
+      __pyx_v_memslice = __pyx_t_8;
+      __pyx_t_2 = (__pyx_v_memslice.memview != 0);
+      if (__pyx_t_2) {
+        __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); 
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_int, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+        goto __pyx_L57_break;
+      }
+      /*else*/ {
+        PyErr_Clear(); 
+      }
+    }
+    __pyx_t_3 = ((__pyx_v_itemsize == -1L) != 0);
+    if (!__pyx_t_3) {
+    } else {
+      __pyx_t_2 = __pyx_t_3;
+      goto __pyx_L83_bool_binop_done;
+    }
+    __pyx_t_3 = ((__pyx_v_itemsize == (sizeof(long))) != 0);
+    __pyx_t_2 = __pyx_t_3;
+    __pyx_L83_bool_binop_done:;
+    if (__pyx_t_2) {
+      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_v_arg, 0); 
+      __pyx_v_memslice = __pyx_t_8;
+      __pyx_t_2 = (__pyx_v_memslice.memview != 0);
+      if (__pyx_t_2) {
+        __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); 
+        if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+        goto __pyx_L57_break;
+      }
+      /*else*/ {
+        PyErr_Clear(); 
+      }
+    }
+    if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 1, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+    goto __pyx_L57_break;
+  }
+  __pyx_L57_break:;
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_v_candidates = ((PyObject*)__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_5 = 0;
+  if (unlikely(__pyx_v_signatures == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+    __PYX_ERR(0, 96, __pyx_L1_error)
+  }
+  __pyx_t_6 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_1);
+  __pyx_t_1 = __pyx_t_6;
+  __pyx_t_6 = 0;
+  while (1) {
+    __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_9, &__pyx_t_5, &__pyx_t_6, NULL, NULL, __pyx_t_10);
+    if (unlikely(__pyx_t_11 == 0)) break;
+    if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_6);
+    __pyx_t_6 = 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, 96, __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, 96, __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, 96, __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_6 = (__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_6)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 96, __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_6 = PyList_GET_ITEM(__pyx_v_dest_sig, __pyx_v_i);
+      __Pyx_INCREF(__pyx_t_6);
+      __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_6);
+      __pyx_t_6 = 0;
+      __pyx_t_2 = (__pyx_v_dst_type != Py_None);
+      __pyx_t_3 = (__pyx_t_2 != 0);
+      if (__pyx_t_3) {
+        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_13 = PyObject_RichCompare(__pyx_t_6, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
+        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+        if (__pyx_t_3) {
+          __pyx_v_match_found = 1;
+          goto __pyx_L91;
+        }
+        /*else*/ {
+          __pyx_v_match_found = 0;
+          goto __pyx_L89_break;
+        }
+        __pyx_L91:;
+      }
+    }
+    __pyx_L89_break:;
+    __pyx_t_3 = (__pyx_v_match_found != 0);
+    if (__pyx_t_3) {
+      __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 96, __pyx_L1_error)
+    }
+  }
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
+  __pyx_t_2 = ((!__pyx_t_3) != 0);
+  if (__pyx_t_2) {
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __PYX_ERR(0, 96, __pyx_L1_error)
+  }
+  __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 96, __pyx_L1_error)
+  __pyx_t_2 = ((__pyx_t_9 > 1) != 0);
+  if (__pyx_t_2) {
+    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __PYX_ERR(0, 96, __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, 96, __pyx_L1_error)
+    }
+    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __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_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_12);
+  __Pyx_XDECREF(__pyx_t_13);
+  __Pyx_XDECREF(__pyx_t_14);
+  __Pyx_AddTraceback("c_corr.__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_TraceReturn(__pyx_r, 0);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_fuse_0_0__pyx_pw_6c_corr_47_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_0_0__pyx_mdef_6c_corr_47_c_corr_core2 = {"__pyx_fuse_0_0_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_0__pyx_pw_6c_corr_47_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_0_0__pyx_pw_6c_corr_47_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED short __pyx_v_curr_tdoa;
+  short __pyx_v_ind_tdoa;
+  short __pyx_v_max_tdoa;
+  short __pyx_v_win_size;
+  short __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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_cc)) != 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_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_short(values[4]); if (unlikely((__pyx_v_curr_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_short(values[5]); if (unlikely((__pyx_v_ind_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_short(values[6]); if (unlikely((__pyx_v_max_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_short(values[7]); if (unlikely((__pyx_v_win_size == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_short(values[8]); if (unlikely((__pyx_v_n_pair == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_46_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_46_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
+  PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  short __pyx_t_1;
+  short __pyx_t_2;
+  long __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_0_0_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_0_0_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
+
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
+ */
+    __pyx_t_4 = __pyx_v_i;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
+
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
+ */
+  __pyx_v_level = 0;
+
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ */
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_short((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_short(__pyx_t_9); if (unlikely((__pyx_t_1 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        }
+
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
+
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
+
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
+ */
+        __pyx_v_val = __pyx_v_tmp_val;
+
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
+ */
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
+
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      }
+
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    }
+    __pyx_L5_continue:;
+  }
+
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_fuse_0_1__pyx_pw_6c_corr_49_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_0_1__pyx_mdef_6c_corr_49_c_corr_core2 = {"__pyx_fuse_0_1_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_1__pyx_pw_6c_corr_49_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_0_1__pyx_pw_6c_corr_49_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED int __pyx_v_curr_tdoa;
+  int __pyx_v_ind_tdoa;
+  int __pyx_v_max_tdoa;
+  int __pyx_v_win_size;
+  int __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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_cc)) != 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_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_curr_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_ind_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_max_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_win_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_n_pair == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_48_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_48_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
+  PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  int __pyx_t_2;
+  long __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  Py_ssize_t __pyx_t_11;
+  Py_ssize_t __pyx_t_12;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_0_1_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_0_1_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
+
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
+ */
+    __pyx_t_4 = __pyx_v_i;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
+
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
+ */
+  __pyx_v_level = 0;
+
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ */
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_1 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_1 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_11 = __pyx_v_j0;
+        __pyx_t_12 = __pyx_v_i;
+        *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_12)) )) = ((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        }
+
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_11 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_12 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_12)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_11 = __pyx_v_i;
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_12 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
+
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
+
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
+ */
+        __pyx_v_val = __pyx_v_tmp_val;
+
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
+ */
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
+
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      }
+
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    }
+    __pyx_L5_continue:;
+  }
+
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_r = __pyx_t_8;
+  __pyx_t_8 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_fuse_0_2__pyx_pw_6c_corr_51_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_0_2__pyx_mdef_6c_corr_51_c_corr_core2 = {"__pyx_fuse_0_2_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0_2__pyx_pw_6c_corr_51_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_0_2__pyx_pw_6c_corr_51_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED long __pyx_v_curr_tdoa;
+  long __pyx_v_ind_tdoa;
+  long __pyx_v_max_tdoa;
+  long __pyx_v_win_size;
+  long __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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_cc)) != 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_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_curr_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_ind_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_max_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_win_size == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_long(values[8]); if (unlikely((__pyx_v_n_pair == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_50_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_50_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
+  PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  long __pyx_t_1;
+  long __pyx_t_2;
+  long __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_0_2_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_0_2_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
+
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
+ */
+    __pyx_t_4 = __pyx_v_i;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
+
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
+ */
+  __pyx_v_level = 0;
+
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ */
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_long((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_t_9); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        }
+
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
+
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
+
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
+ */
+        __pyx_v_val = __pyx_v_tmp_val;
+
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
+ */
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
+
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      }
+
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    }
+    __pyx_L5_continue:;
+  }
+
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_fuse_1_0__pyx_pw_6c_corr_53_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_1_0__pyx_mdef_6c_corr_53_c_corr_core2 = {"__pyx_fuse_1_0_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_0__pyx_pw_6c_corr_53_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_1_0__pyx_pw_6c_corr_53_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED short __pyx_v_curr_tdoa;
+  short __pyx_v_ind_tdoa;
+  short __pyx_v_max_tdoa;
+  short __pyx_v_win_size;
+  short __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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_cc)) != 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_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_short(values[4]); if (unlikely((__pyx_v_curr_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_short(values[5]); if (unlikely((__pyx_v_ind_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_short(values[6]); if (unlikely((__pyx_v_max_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_short(values[7]); if (unlikely((__pyx_v_win_size == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_short(values[8]); if (unlikely((__pyx_v_n_pair == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_52_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_52_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
+  PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  short __pyx_t_1;
+  short __pyx_t_2;
+  long __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_1_0_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_1_0_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
+
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
+ */
+    __pyx_t_4 = __pyx_v_i;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
+
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
+ */
+  __pyx_v_level = 0;
+
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ */
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_short((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_short(__pyx_t_9); if (unlikely((__pyx_t_1 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        }
+
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
+
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
+
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
+ */
+        __pyx_v_val = __pyx_v_tmp_val;
+
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
+ */
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
+
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      }
+
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    }
+    __pyx_L5_continue:;
+  }
+
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_fuse_1_1__pyx_pw_6c_corr_55_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_1_1__pyx_mdef_6c_corr_55_c_corr_core2 = {"__pyx_fuse_1_1_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_1__pyx_pw_6c_corr_55_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_1_1__pyx_pw_6c_corr_55_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED int __pyx_v_curr_tdoa;
+  int __pyx_v_ind_tdoa;
+  int __pyx_v_max_tdoa;
+  int __pyx_v_win_size;
+  int __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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_cc)) != 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_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_curr_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_ind_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_max_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_win_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_n_pair == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_54_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_54_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
+  PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  int __pyx_t_2;
+  long __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  Py_ssize_t __pyx_t_11;
+  Py_ssize_t __pyx_t_12;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_1_1_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_1_1_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
+
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
+ */
+    __pyx_t_4 = __pyx_v_i;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
+
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
+ */
+  __pyx_v_level = 0;
+
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ */
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_1 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_1 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_11 = __pyx_v_j0;
+        __pyx_t_12 = __pyx_v_i;
+        *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_12)) )) = ((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        }
+
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_11 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_12 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_12)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_11 = __pyx_v_i;
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_12 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
+
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
+
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
+ */
+        __pyx_v_val = __pyx_v_tmp_val;
+
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
+ */
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
+
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      }
+
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    }
+    __pyx_L5_continue:;
+  }
+
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_r = __pyx_t_8;
+  __pyx_t_8 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_fuse_1_2__pyx_pw_6c_corr_57_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_1_2__pyx_mdef_6c_corr_57_c_corr_core2 = {"__pyx_fuse_1_2_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1_2__pyx_pw_6c_corr_57_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_1_2__pyx_pw_6c_corr_57_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED long __pyx_v_curr_tdoa;
+  long __pyx_v_ind_tdoa;
+  long __pyx_v_max_tdoa;
+  long __pyx_v_win_size;
+  long __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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_cc)) != 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_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_curr_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_ind_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_max_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_win_size == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_long(values[8]); if (unlikely((__pyx_v_n_pair == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_56_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_56_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
+  PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  long __pyx_t_1;
+  long __pyx_t_2;
+  long __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_1_2_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_1_2_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
+
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
+ */
+    __pyx_t_4 = __pyx_v_i;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
+
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
+ */
+  __pyx_v_level = 0;
+
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ */
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_long((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_t_9); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        }
+
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((int *) ( /* dim=1 */ ((char *) (((int *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
+
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
+
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
+ */
+        __pyx_v_val = __pyx_v_tmp_val;
+
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
+ */
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
+
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      }
+
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    }
+    __pyx_L5_continue:;
+  }
+
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
+  goto __pyx_L0;
+
+  /* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_fuse_2_0__pyx_pw_6c_corr_59_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_2_0__pyx_mdef_6c_corr_59_c_corr_core2 = {"__pyx_fuse_2_0_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_0__pyx_pw_6c_corr_59_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_2_0__pyx_pw_6c_corr_59_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED short __pyx_v_curr_tdoa;
+  short __pyx_v_ind_tdoa;
+  short __pyx_v_max_tdoa;
+  short __pyx_v_win_size;
+  short __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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_cc)) != 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_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_short(values[4]); if (unlikely((__pyx_v_curr_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_short(values[5]); if (unlikely((__pyx_v_ind_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_short(values[6]); if (unlikely((__pyx_v_max_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_short(values[7]); if (unlikely((__pyx_v_win_size == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_short(values[8]); if (unlikely((__pyx_v_n_pair == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6c_corr_58_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
+
+  /* function exit code */
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6c_corr_58_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
+  PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannyDeclarations
+  short __pyx_t_1;
+  short __pyx_t_2;
+  long __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_2_0_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_2_0_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
+
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+    __pyx_t_4 = __pyx_v_i;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+  __pyx_v_level = 0;
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-      __pyx_v_index = __pyx_v_i;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_short((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_short(__pyx_t_9); if (unlikely((__pyx_t_1 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        }
+
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
+
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
+
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
+ */
+        __pyx_v_val = __pyx_v_tmp_val;
+
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
+ */
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
+
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ */
+      }
+
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_4_0__pyx_pw_6c_corr_35c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_4_0__pyx_mdef_6c_corr_35c_corr = {"__pyx_fuse_4_0c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_0__pyx_pw_6c_corr_35c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_4_0__pyx_pw_6c_corr_35c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_2_1__pyx_pw_6c_corr_61_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_2_1__pyx_mdef_6c_corr_61_c_corr_core2 = {"__pyx_fuse_2_1_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_1__pyx_pw_6c_corr_61_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_2_1__pyx_pw_6c_corr_61_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED int __pyx_v_curr_tdoa;
+  int __pyx_v_ind_tdoa;
+  int __pyx_v_max_tdoa;
+  int __pyx_v_win_size;
+  int __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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);
@@ -7967,275 +15346,590 @@ static PyObject *__pyx_fuse_4_0__pyx_pw_6c_corr_35c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
       goto __pyx_L5_argtuple_error;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-    }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_curr_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_ind_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_max_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_win_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_n_pair == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_34c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_60_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_34c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
-  Py_ssize_t __pyx_v_i;
-  Py_ssize_t __pyx_v_p;
+static PyObject *__pyx_pf_6c_corr_60_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
   PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
   __Pyx_RefNannyDeclarations
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  int __pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
-  Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
-  int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_4_0c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  Py_ssize_t __pyx_t_11;
+  Py_ssize_t __pyx_t_12;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_2_1_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_2_1_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
 
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-  __pyx_v_index = 0;
+    __pyx_t_4 = __pyx_v_i;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-  __pyx_v_corr_val = 0.0;
+  __pyx_v_level = 0;
 
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_1 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_1 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
 
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_11 = __pyx_v_j0;
+        __pyx_t_12 = __pyx_v_i;
+        *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_12)) )) = ((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
  */
-    __pyx_v_corr_val = 1.0;
+        }
 
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_11 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_12 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_12)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
  */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_11 = __pyx_v_i;
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_12 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
 
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((short *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
-    }
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
 
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+        __pyx_v_val = __pyx_v_tmp_val;
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_v_index = __pyx_v_i;
+      }
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_r = __pyx_t_8;
+  __pyx_t_8 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_4_1__pyx_pw_6c_corr_37c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_4_1__pyx_mdef_6c_corr_37c_corr = {"__pyx_fuse_4_1c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_1__pyx_pw_6c_corr_37c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_4_1__pyx_pw_6c_corr_37c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_2_2__pyx_pw_6c_corr_63_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_2_2__pyx_mdef_6c_corr_63_c_corr_core2 = {"__pyx_fuse_2_2_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_2_2__pyx_pw_6c_corr_63_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_2_2__pyx_pw_6c_corr_63_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED long __pyx_v_curr_tdoa;
+  long __pyx_v_ind_tdoa;
+  long __pyx_v_max_tdoa;
+  long __pyx_v_win_size;
+  long __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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);
@@ -8252,275 +15946,591 @@ static PyObject *__pyx_fuse_4_1__pyx_pw_6c_corr_37c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
       goto __pyx_L5_argtuple_error;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-    }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_curr_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_ind_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_max_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_win_size == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_long(values[8]); if (unlikely((__pyx_v_n_pair == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_36c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_62_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_36c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
-  Py_ssize_t __pyx_v_i;
-  Py_ssize_t __pyx_v_p;
+static PyObject *__pyx_pf_6c_corr_62_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
   PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
   __Pyx_RefNannyDeclarations
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  long __pyx_t_1;
+  long __pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
-  Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
-  int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_4_1c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_2_2_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_2_2_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
 
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-  __pyx_v_index = 0;
+    __pyx_t_4 = __pyx_v_i;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-  __pyx_v_corr_val = 0.0;
+  __pyx_v_level = 0;
 
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_long((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
 
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_t_9); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
  */
-    __pyx_v_corr_val = 1.0;
+        }
 
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
  */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
 
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
-    }
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
 
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+        __pyx_v_val = __pyx_v_tmp_val;
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_v_index = __pyx_v_i;
+      }
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_4_2__pyx_pw_6c_corr_39c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_4_2__pyx_mdef_6c_corr_39c_corr = {"__pyx_fuse_4_2c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_2__pyx_pw_6c_corr_39c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_4_2__pyx_pw_6c_corr_39c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_3_0__pyx_pw_6c_corr_65_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_3_0__pyx_mdef_6c_corr_65_c_corr_core2 = {"__pyx_fuse_3_0_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_0__pyx_pw_6c_corr_65_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_3_0__pyx_pw_6c_corr_65_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED short __pyx_v_curr_tdoa;
+  short __pyx_v_ind_tdoa;
+  short __pyx_v_max_tdoa;
+  short __pyx_v_win_size;
+  short __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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);
@@ -8537,275 +16547,591 @@ static PyObject *__pyx_fuse_4_2__pyx_pw_6c_corr_39c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
       goto __pyx_L5_argtuple_error;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-    }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_short(values[4]); if (unlikely((__pyx_v_curr_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_short(values[5]); if (unlikely((__pyx_v_ind_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_short(values[6]); if (unlikely((__pyx_v_max_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_short(values[7]); if (unlikely((__pyx_v_win_size == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_short(values[8]); if (unlikely((__pyx_v_n_pair == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_38c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_64_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_38c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
-  Py_ssize_t __pyx_v_i;
-  Py_ssize_t __pyx_v_p;
+static PyObject *__pyx_pf_6c_corr_64_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
   PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
   __Pyx_RefNannyDeclarations
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  short __pyx_t_1;
+  short __pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
-  Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
-  int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_4_2c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_3_0_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_3_0_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
 
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-  __pyx_v_index = 0;
+    __pyx_t_4 = __pyx_v_i;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-  __pyx_v_corr_val = 0.0;
+  __pyx_v_level = 0;
 
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_short((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
 
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_short(__pyx_t_9); if (unlikely((__pyx_t_1 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
  */
-    __pyx_v_corr_val = 1.0;
+        }
 
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
  */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
 
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
-    }
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
 
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+        __pyx_v_val = __pyx_v_tmp_val;
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_v_index = __pyx_v_i;
+      }
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_4_3__pyx_pw_6c_corr_41c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_4_3__pyx_mdef_6c_corr_41c_corr = {"__pyx_fuse_4_3c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_3__pyx_pw_6c_corr_41c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_4_3__pyx_pw_6c_corr_41c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_3_1__pyx_pw_6c_corr_67_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_3_1__pyx_mdef_6c_corr_67_c_corr_core2 = {"__pyx_fuse_3_1_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_1__pyx_pw_6c_corr_67_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_3_1__pyx_pw_6c_corr_67_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED int __pyx_v_curr_tdoa;
+  int __pyx_v_ind_tdoa;
+  int __pyx_v_max_tdoa;
+  int __pyx_v_win_size;
+  int __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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);
@@ -8822,275 +17148,590 @@ static PyObject *__pyx_fuse_4_3__pyx_pw_6c_corr_41c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
       goto __pyx_L5_argtuple_error;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-    }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_curr_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_ind_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_max_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_win_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_n_pair == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_40c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_66_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_40c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
-  Py_ssize_t __pyx_v_i;
-  Py_ssize_t __pyx_v_p;
+static PyObject *__pyx_pf_6c_corr_66_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
   PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
   __Pyx_RefNannyDeclarations
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  int __pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
-  Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  PY_LONG_LONG __pyx_t_10;
-  int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_4_3c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  Py_ssize_t __pyx_t_11;
+  Py_ssize_t __pyx_t_12;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_3_1_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_3_1_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
 
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-  __pyx_v_index = 0;
+    __pyx_t_4 = __pyx_v_i;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-  __pyx_v_corr_val = 0.0;
+  __pyx_v_level = 0;
 
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_1 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_1 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
 
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_11 = __pyx_v_j0;
+        __pyx_t_12 = __pyx_v_i;
+        *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_12)) )) = ((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
  */
-    __pyx_v_corr_val = 1.0;
+        }
 
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_11 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_12 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_12)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
  */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_11 = __pyx_v_i;
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_12 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
 
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((PY_LONG_LONG *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((PY_LONG_LONG *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
-    }
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
 
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+        __pyx_v_val = __pyx_v_tmp_val;
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_v_index = __pyx_v_i;
+      }
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_r = __pyx_t_8;
+  __pyx_t_8 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_5_0__pyx_pw_6c_corr_43c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_5_0__pyx_mdef_6c_corr_43c_corr = {"__pyx_fuse_5_0c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_5_0__pyx_pw_6c_corr_43c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_5_0__pyx_pw_6c_corr_43c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_3_2__pyx_pw_6c_corr_69_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_3_2__pyx_mdef_6c_corr_69_c_corr_core2 = {"__pyx_fuse_3_2_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_3_2__pyx_pw_6c_corr_69_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_3_2__pyx_pw_6c_corr_69_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED long __pyx_v_curr_tdoa;
+  long __pyx_v_ind_tdoa;
+  long __pyx_v_max_tdoa;
+  long __pyx_v_win_size;
+  long __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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);
@@ -9107,275 +17748,591 @@ static PyObject *__pyx_fuse_5_0__pyx_pw_6c_corr_43c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
       goto __pyx_L5_argtuple_error;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-    }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_curr_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_ind_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_max_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_win_size == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_long(values[8]); if (unlikely((__pyx_v_n_pair == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_42c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_68_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_42c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
-  Py_ssize_t __pyx_v_i;
-  Py_ssize_t __pyx_v_p;
+static PyObject *__pyx_pf_6c_corr_68_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
   PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
   __Pyx_RefNannyDeclarations
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  long __pyx_t_1;
+  long __pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
-  Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
-  int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_5_0c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_3_2_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_3_2_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
 
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-  __pyx_v_index = 0;
+    __pyx_t_4 = __pyx_v_i;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-  __pyx_v_corr_val = 0.0;
+  __pyx_v_level = 0;
 
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_long((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
 
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_t_9); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
  */
-    __pyx_v_corr_val = 1.0;
+        }
 
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
  */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
 
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((short *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
-    }
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
 
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+        __pyx_v_val = __pyx_v_tmp_val;
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_v_index = __pyx_v_i;
+      }
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_5_1__pyx_pw_6c_corr_45c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_5_1__pyx_mdef_6c_corr_45c_corr = {"__pyx_fuse_5_1c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_5_1__pyx_pw_6c_corr_45c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_5_1__pyx_pw_6c_corr_45c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_4_0__pyx_pw_6c_corr_71_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_4_0__pyx_mdef_6c_corr_71_c_corr_core2 = {"__pyx_fuse_4_0_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_0__pyx_pw_6c_corr_71_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_4_0__pyx_pw_6c_corr_71_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED short __pyx_v_curr_tdoa;
+  short __pyx_v_ind_tdoa;
+  short __pyx_v_max_tdoa;
+  short __pyx_v_win_size;
+  short __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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);
@@ -9392,275 +18349,591 @@ static PyObject *__pyx_fuse_5_1__pyx_pw_6c_corr_45c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
       goto __pyx_L5_argtuple_error;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-    }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_short(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_short(values[4]); if (unlikely((__pyx_v_curr_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_short(values[5]); if (unlikely((__pyx_v_ind_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_short(values[6]); if (unlikely((__pyx_v_max_tdoa == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_short(values[7]); if (unlikely((__pyx_v_win_size == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_short(values[8]); if (unlikely((__pyx_v_n_pair == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_44c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_70_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_44c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
-  Py_ssize_t __pyx_v_i;
-  Py_ssize_t __pyx_v_p;
+static PyObject *__pyx_pf_6c_corr_70_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED short __pyx_v_curr_tdoa, short __pyx_v_ind_tdoa, short __pyx_v_max_tdoa, short __pyx_v_win_size, short __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
   PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
   __Pyx_RefNannyDeclarations
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  short __pyx_t_1;
+  short __pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
-  Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
-  int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_5_1c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_4_0_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_4_0_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
 
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-  __pyx_v_index = 0;
+    __pyx_t_4 = __pyx_v_i;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-  __pyx_v_corr_val = 0.0;
+  __pyx_v_level = 0;
 
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_short((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
 
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_short, (int (*)(char *, PyObject *)) __pyx_memview_set_short, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_short(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_short(__pyx_t_9); if (unlikely((__pyx_t_1 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
  */
-    __pyx_v_corr_val = 1.0;
+        }
 
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
  */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((short *) ( /* dim=0 */ ((char *) (((short *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
 
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
-    }
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
 
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+        __pyx_v_val = __pyx_v_tmp_val;
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_v_index = __pyx_v_i;
+      }
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_5_2__pyx_pw_6c_corr_47c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_5_2__pyx_mdef_6c_corr_47c_corr = {"__pyx_fuse_5_2c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_5_2__pyx_pw_6c_corr_47c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_5_2__pyx_pw_6c_corr_47c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_4_1__pyx_pw_6c_corr_73_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_4_1__pyx_mdef_6c_corr_73_c_corr_core2 = {"__pyx_fuse_4_1_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_1__pyx_pw_6c_corr_73_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_4_1__pyx_pw_6c_corr_73_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED int __pyx_v_curr_tdoa;
+  int __pyx_v_ind_tdoa;
+  int __pyx_v_max_tdoa;
+  int __pyx_v_win_size;
+  int __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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);
@@ -9677,275 +18950,590 @@ static PyObject *__pyx_fuse_5_2__pyx_pw_6c_corr_47c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
       goto __pyx_L5_argtuple_error;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-    }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_curr_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_ind_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_max_tdoa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_win_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_n_pair == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_46c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_72_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_46c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
-  Py_ssize_t __pyx_v_i;
-  Py_ssize_t __pyx_v_p;
+static PyObject *__pyx_pf_6c_corr_72_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED int __pyx_v_curr_tdoa, int __pyx_v_ind_tdoa, int __pyx_v_max_tdoa, int __pyx_v_win_size, int __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
   PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
   __Pyx_RefNannyDeclarations
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  int __pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
-  Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
-  int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_5_2c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  Py_ssize_t __pyx_t_11;
+  Py_ssize_t __pyx_t_12;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_4_1_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_4_1_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
 
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-  __pyx_v_index = 0;
+    __pyx_t_4 = __pyx_v_i;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-  __pyx_v_corr_val = 0.0;
+  __pyx_v_level = 0;
 
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_1 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
+
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_1 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_1,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
 
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
+__pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_11 = __pyx_v_j0;
+        __pyx_t_12 = __pyx_v_i;
+        *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_12)) )) = ((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
  */
-    __pyx_v_corr_val = 1.0;
+        }
 
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_11 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_12 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_12)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
  */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_11 = __pyx_v_i;
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_taus.data) + __pyx_t_11)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_12 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
 
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
-    }
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
 
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+        __pyx_v_val = __pyx_v_tmp_val;
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_v_index = __pyx_v_i;
+      }
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_r = __pyx_t_8;
+  __pyx_t_8 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_fuse_5_3__pyx_pw_6c_corr_49c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_fuse_5_3__pyx_mdef_6c_corr_49c_corr = {"__pyx_fuse_5_3c_corr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_5_3__pyx_pw_6c_corr_49c_corr, METH_VARARGS|METH_KEYWORDS, 0};
-static PyObject *__pyx_fuse_5_3__pyx_pw_6c_corr_49c_corr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_fuse_4_2__pyx_pw_6c_corr_75_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_fuse_4_2__pyx_mdef_6c_corr_75_c_corr_core2 = {"__pyx_fuse_4_2_c_corr_core2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_4_2__pyx_pw_6c_corr_75_c_corr_core2, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_fuse_4_2__pyx_pw_6c_corr_75_c_corr_core2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_cc = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_out_taus = { 0, 0, { 0 }, { 0 }, { 0 } };
+  double __pyx_v_val;
+  CYTHON_UNUSED long __pyx_v_curr_tdoa;
+  long __pyx_v_ind_tdoa;
+  long __pyx_v_max_tdoa;
+  long __pyx_v_win_size;
+  long __pyx_v_n_pair;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("c_corr (wrapper)", 0);
+  __Pyx_RefNannySetupContext("_c_corr_core2 (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,0};
-    PyObject* values[2] = {0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cc,&__pyx_n_s_taus,&__pyx_n_s_out_taus,&__pyx_n_s_val,&__pyx_n_s_curr_tdoa,&__pyx_n_s_ind_tdoa,&__pyx_n_s_max_tdoa,&__pyx_n_s_win_size,&__pyx_n_s_n_pair,0};
+    PyObject* values[9] = {0,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  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        CYTHON_FALLTHROUGH;
+        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);
@@ -9962,255 +19550,547 @@ static PyObject *__pyx_fuse_5_3__pyx_pw_6c_corr_49c_corr(PyObject *__pyx_self, P
         case  1:
         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_taus)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, 1); __PYX_ERR(0, 23, __pyx_L3_error)
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 1); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_taus)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 2); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 3); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_curr_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 4); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  5:
+        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 5); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  6:
+        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_tdoa)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 6); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  7:
+        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_size)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 7); __PYX_ERR(0, 96, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  8:
+        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pair)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, 8); __PYX_ERR(0, 96, __pyx_L3_error)
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_corr") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_corr_core2") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
       }
-    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
       goto __pyx_L5_argtuple_error;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-    }
-    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
-    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
+      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);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_cc = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cc.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_out_taus = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out_taus.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L3_error)
+    __pyx_v_curr_tdoa = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_curr_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_ind_tdoa = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_ind_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_max_tdoa = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_max_tdoa == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_win_size = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_win_size == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
+    __pyx_v_n_pair = __Pyx_PyInt_As_long(values[8]); if (unlikely((__pyx_v_n_pair == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("c_corr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
+  __Pyx_RaiseArgtupleInvalid("_c_corr_core2", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
   __pyx_L3_error:;
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6c_corr_48c_corr(__pyx_self, __pyx_v_cc, __pyx_v_taus);
+  __pyx_r = __pyx_pf_6c_corr_74_c_corr_core2(__pyx_self, __pyx_v_cc, __pyx_v_taus, __pyx_v_out_taus, __pyx_v_val, __pyx_v_curr_tdoa, __pyx_v_ind_tdoa, __pyx_v_max_tdoa, __pyx_v_win_size, __pyx_v_n_pair);
 
   /* function exit code */
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_6c_corr_48c_corr(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus) {
-  Py_ssize_t __pyx_v_total;
-  Py_ssize_t __pyx_v_n_pair;
-  double __pyx_v_max_corr_val;
-  int __pyx_v_index;
-  double __pyx_v_corr_val;
-  Py_ssize_t __pyx_v_i;
-  Py_ssize_t __pyx_v_p;
+static PyObject *__pyx_pf_6c_corr_74_c_corr_core2(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_cc, __Pyx_memviewslice __pyx_v_taus, __Pyx_memviewslice __pyx_v_out_taus, double __pyx_v_val, CYTHON_UNUSED long __pyx_v_curr_tdoa, long __pyx_v_ind_tdoa, long __pyx_v_max_tdoa, long __pyx_v_win_size, long __pyx_v_n_pair) {
+  int __pyx_v_i0;
+  int __pyx_v_j0;
+  double __pyx_v_tmp_val;
+  long __pyx_v_i;
+  int __pyx_v_level;
   PyObject *__pyx_r = NULL;
+  __Pyx_TraceDeclarations
   __Pyx_RefNannyDeclarations
-  Py_ssize_t __pyx_t_1;
-  Py_ssize_t __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  long __pyx_t_1;
+  long __pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  Py_ssize_t __pyx_t_6;
-  Py_ssize_t __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  Py_ssize_t __pyx_t_9;
-  PY_LONG_LONG __pyx_t_10;
-  int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  __Pyx_RefNannySetupContext("__pyx_fuse_5_3c_corr", 0);
-
-  /* "c_corr.pyx":24
- * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]             # <<<<<<<<<<<<<<
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- */
-  __pyx_v_total = (__pyx_v_taus.shape[1]);
-
-  /* "c_corr.pyx":25
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]             # <<<<<<<<<<<<<<
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- */
-  __pyx_v_n_pair = (__pyx_v_taus.shape[0]);
-
-  /* "c_corr.pyx":26
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0             # <<<<<<<<<<<<<<
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- */
-  __pyx_v_max_corr_val = 0.0;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__pyx_fuse_4_2_c_corr_core2", 0);
+  __Pyx_TraceCall("__pyx_fuse_4_2_c_corr_core2", __pyx_f[0], 96, 0, __PYX_ERR(0, 96, __pyx_L1_error));
+
+  /* "c_corr.pyx":98
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1             # <<<<<<<<<<<<<<
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ */
+  __pyx_v_i0 = 1;
+
+  /* "c_corr.pyx":99
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0             # <<<<<<<<<<<<<<
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ */
+  __pyx_v_j0 = 0;
+
+  /* "c_corr.pyx":100
+ *     cdef int i0 = 1
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0             # <<<<<<<<<<<<<<
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ */
+  __pyx_v_tmp_val = 0.0;
+
+  /* "c_corr.pyx":101
+ *     cdef int j0 = 0
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):             # <<<<<<<<<<<<<<
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ */
+  __pyx_t_1 = __pyx_v_ind_tdoa;
+  __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;
 
-  /* "c_corr.pyx":27
- *     n_pair = taus.shape[0]
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0             # <<<<<<<<<<<<<<
- *     cdef double corr_val = 0.0
- *     for i in range(total):
+    /* "c_corr.pyx":102
+ *     cdef double tmp_val = 0.0
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *     cdef int level = 0
+ *     while level >= 0:
  */
-  __pyx_v_index = 0;
+    __pyx_t_4 = __pyx_v_i;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = ((-__pyx_v_max_tdoa) - 1);
+  }
 
-  /* "c_corr.pyx":28
- *     cdef double max_corr_val = 0.0
- *     cdef int index = 0
- *     cdef double corr_val = 0.0             # <<<<<<<<<<<<<<
- *     for i in range(total):
- *         corr_val = 1.0
+  /* "c_corr.pyx":103
+ *     for i in range(ind_tdoa):
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0             # <<<<<<<<<<<<<<
+ *     while level >= 0:
+ *         taus[level] += 1
  */
-  __pyx_v_corr_val = 0.0;
+  __pyx_v_level = 0;
 
-  /* "c_corr.pyx":29
- *     cdef int index = 0
- *     cdef double corr_val = 0.0
- *     for i in range(total):             # <<<<<<<<<<<<<<
- *         corr_val = 1.0
- *         for p in range(n_pair):
+  /* "c_corr.pyx":104
+ *         taus[i] =  - max_tdoa - 1
+ *     cdef int level = 0
+ *     while level >= 0:             # <<<<<<<<<<<<<<
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
  */
-  __pyx_t_1 = __pyx_v_total;
-  __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;
+  while (1) {
+    __pyx_t_5 = ((__pyx_v_level >= 0) != 0);
+    if (!__pyx_t_5) break;
+
+    /* "c_corr.pyx":105
+ *     cdef int level = 0
+ *     while level >= 0:
+ *         taus[level] += 1             # <<<<<<<<<<<<<<
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) += 1;
+
+    /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    __pyx_t_4 = __pyx_v_level;
+    __pyx_t_6 = __Pyx_PyInt_From_long((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_7.data = __pyx_v_taus.data;
+    __pyx_t_7.memview = __pyx_v_taus.memview;
+    __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+    __pyx_t_8 = -1;
+    if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 106, __pyx_L1_error)
+}
 
-    /* "c_corr.pyx":30
- *     cdef double corr_val = 0.0
- *     for i in range(total):
- *         corr_val = 1.0             # <<<<<<<<<<<<<<
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+    __pyx_t_7.memview = NULL;
+    __pyx_t_7.data = NULL;
+    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":107
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             continue
+ */
+      __pyx_t_7.data = __pyx_v_taus.data;
+      __pyx_t_7.memview = __pyx_v_taus.memview;
+      __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
+      __pyx_t_8 = -1;
+      if (unlikely(__pyx_memoryview_slice_memviewslice(
+    &__pyx_t_7,
+    __pyx_v_taus.shape[0], __pyx_v_taus.strides[0], __pyx_v_taus.suboffsets[0],
+    0,
+    0,
+    &__pyx_t_8,
+    0,
+    __pyx_v_level,
+    0,
+    0,
+    1,
+    0,
+    1) < 0))
+{
+    __PYX_ERR(0, 107, __pyx_L1_error)
+}
+
+__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+      __pyx_t_7.memview = NULL;
+      __pyx_t_7.data = NULL;
+      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_max_tdoa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_t_9); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_4 = __pyx_v_level;
+      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) )) = __pyx_t_1;
+
+      /* "c_corr.pyx":108
+ *         if taus[level] > min(taus[:level]) + max_tdoa:
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             continue
+ *         level +=1
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":109
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ *             continue             # <<<<<<<<<<<<<<
+ *         level +=1
+ *         if level == ind_tdoa:
+ */
+      goto __pyx_L5_continue;
+
+      /* "c_corr.pyx":106
+ *     while level >= 0:
+ *         taus[level] += 1
+ *         if taus[level] > min(taus[:level]) + max_tdoa:             # <<<<<<<<<<<<<<
+ *             taus[level] = max(taus[:level]) - max_tdoa - 1
+ *             level -= 1
+ */
+    }
+
+    /* "c_corr.pyx":110
+ *             level -= 1
+ *             continue
+ *         level +=1             # <<<<<<<<<<<<<<
+ *         if level == ind_tdoa:
+ *             level -= 1
+ */
+    __pyx_v_level = (__pyx_v_level + 1);
+
+    /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ */
+    __pyx_t_5 = ((__pyx_v_level == __pyx_v_ind_tdoa) != 0);
+    if (__pyx_t_5) {
+
+      /* "c_corr.pyx":112
+ *         level +=1
+ *         if level == ind_tdoa:
+ *             level -= 1             # <<<<<<<<<<<<<<
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ */
+      __pyx_v_level = (__pyx_v_level - 1);
+
+      /* "c_corr.pyx":113
+ *         if level == ind_tdoa:
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):             # <<<<<<<<<<<<<<
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ */
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = __pyx_v_ind_tdoa; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":114
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]             # <<<<<<<<<<<<<<
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ */
+        __pyx_t_4 = __pyx_v_i0;
+        __pyx_t_12 = __pyx_v_j0;
+        __pyx_t_13 = __pyx_v_i;
+        *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_13)) )) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_4)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))));
+
+        /* "c_corr.pyx":115
+ *             for i in range(ind_tdoa, n_pair):
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1             # <<<<<<<<<<<<<<
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ */
+        __pyx_v_i0 = (__pyx_v_i0 + 1);
+
+        /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ */
+        __pyx_t_5 = ((__pyx_v_i0 >= __pyx_v_ind_tdoa) != 0);
+        if (__pyx_t_5) {
+
+          /* "c_corr.pyx":117
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1             # <<<<<<<<<<<<<<
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ */
+          __pyx_v_j0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":118
+ *                 if i0 >= ind_tdoa:
+ *                     j0 += 1
+ *                     i0 = j0 + 1             # <<<<<<<<<<<<<<
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ */
+          __pyx_v_i0 = (__pyx_v_j0 + 1);
+
+          /* "c_corr.pyx":116
+ *                 taus[i] = taus[i0] - taus[j0]
+ *                 i0 += 1
+ *                 if i0 >= ind_tdoa:             # <<<<<<<<<<<<<<
+ *                     j0 += 1
+ *                     i0 = j0 + 1
  */
-    __pyx_v_corr_val = 1.0;
+        }
 
-    /* "c_corr.pyx":31
- *     for i in range(total):
- *         corr_val = 1.0
- *         for p in range(n_pair):             # <<<<<<<<<<<<<<
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
+        /* "c_corr.pyx":119
+ *                     j0 += 1
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]             # <<<<<<<<<<<<<<
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ */
+        __pyx_t_12 = 0;
+        __pyx_t_4 = 0;
+        __pyx_t_13 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_4 * __pyx_v_cc.strides[0]) )) + __pyx_t_13)) )));
+      }
+
+      /* "c_corr.pyx":120
+ *                     i0 = j0 + 1
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):             # <<<<<<<<<<<<<<
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
  */
-    __pyx_t_4 = __pyx_v_n_pair;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_p = __pyx_t_6;
+      __pyx_t_1 = __pyx_v_n_pair;
+      __pyx_t_2 = __pyx_t_1;
+      for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+        __pyx_v_i = __pyx_t_3;
+
+        /* "c_corr.pyx":121
+ *                 tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]             # <<<<<<<<<<<<<<
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ */
+        __pyx_t_12 = __pyx_v_i;
+        __pyx_t_13 = __pyx_v_i;
+        __pyx_t_4 = __pyx_f_6c_corr_moduloNeg((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_taus.data) + __pyx_t_12)) ))), __pyx_v_win_size);
+        __pyx_v_tmp_val = (__pyx_v_tmp_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_13 * __pyx_v_cc.strides[0]) )) + __pyx_t_4)) ))));
+      }
 
-      /* "c_corr.pyx":32
- *         corr_val = 1.0
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]             # <<<<<<<<<<<<<<
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
+      /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_t_7 = __pyx_v_p;
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_p;
-      __pyx_t_10 = (*((PY_LONG_LONG *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((PY_LONG_LONG *) __pyx_v_taus.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_taus.strides[1]) )));
-      __pyx_v_corr_val = (__pyx_v_corr_val * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_cc.data + __pyx_t_9 * __pyx_v_cc.strides[0]) )) + __pyx_t_10)) ))));
-    }
+      __pyx_t_5 = ((__pyx_v_val < __pyx_v_tmp_val) != 0);
+      if (__pyx_t_5) {
 
-    /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+        /* "c_corr.pyx":123
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:
+ *                 val = tmp_val             # <<<<<<<<<<<<<<
+ *                 out_taus[:] = taus
+ *     return val
  */
-    __pyx_t_11 = ((__pyx_v_corr_val > __pyx_v_max_corr_val) != 0);
-    if (__pyx_t_11) {
+        __pyx_v_val = __pyx_v_tmp_val;
 
-      /* "c_corr.pyx":34
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val             # <<<<<<<<<<<<<<
- *             index = i
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":124
+ *             if val < tmp_val:
+ *                 val = tmp_val
+ *                 out_taus[:] = taus             # <<<<<<<<<<<<<<
+ *     return val
  */
-      __pyx_v_max_corr_val = __pyx_v_corr_val;
+        if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_taus, __pyx_v_out_taus, 1, 1, 0) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
 
-      /* "c_corr.pyx":35
- *         if corr_val > max_corr_val:
- *             max_corr_val = corr_val
- *             index = i             # <<<<<<<<<<<<<<
- *     return np.log10(max_corr_val), index
+        /* "c_corr.pyx":122
+ *             for i in range(1, n_pair):
+ *                 tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+ *             if val < tmp_val:             # <<<<<<<<<<<<<<
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
  */
-      __pyx_v_index = __pyx_v_i;
+      }
 
-      /* "c_corr.pyx":33
- *         for p in range(n_pair):
- *             corr_val *= cc[p, taus[p, i]]
- *         if corr_val > max_corr_val:             # <<<<<<<<<<<<<<
- *             max_corr_val = corr_val
- *             index = i
+      /* "c_corr.pyx":111
+ *             continue
+ *         level +=1
+ *         if level == ind_tdoa:             # <<<<<<<<<<<<<<
+ *             level -= 1
+ *             for i in range(ind_tdoa, n_pair):
  */
     }
+    __pyx_L5_continue:;
   }
 
-  /* "c_corr.pyx":36
- *             max_corr_val = corr_val
- *             index = i
- *     return np.log10(max_corr_val), index             # <<<<<<<<<<<<<<
+  /* "c_corr.pyx":125
+ *                 val = tmp_val
+ *                 out_taus[:] = taus
+ *     return val             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_max_corr_val); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_15 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
-    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
-    if (likely(__pyx_t_15)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
-      __Pyx_INCREF(__pyx_t_15);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_14, function);
-    }
-  }
-  __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __pyx_t_12 = 0;
-  __pyx_t_14 = 0;
-  __pyx_r = __pyx_t_13;
-  __pyx_t_13 = 0;
+  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_r = __pyx_t_9;
+  __pyx_t_9 = 0;
   goto __pyx_L0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":96
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
- *     total = taus.shape[1]
- *     n_pair = taus.shape[0]
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
  */
 
   /* function exit code */
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("c_corr.c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_AddTraceback("c_corr._c_corr_core2", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __PYX_XDEC_MEMVIEW(&__pyx_v_cc, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_v_taus, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_out_taus, 1);
   __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r, 0);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
@@ -10231,6 +20111,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -10369,6 +20252,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __
   Py_ssize_t __pyx_t_9;
   PyObject *__pyx_t_10 = NULL;
   Py_ssize_t __pyx_t_11;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
   __Pyx_INCREF(__pyx_v_format);
 
@@ -10992,6 +20878,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru
   Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   Py_ssize_t *__pyx_t_7;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   if (__pyx_v_info == NULL) {
     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
     return -1;
@@ -11420,6 +21309,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":223
@@ -11470,6 +21362,9 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("get_memview", 0);
 
   /* "View.MemoryView":227
@@ -11608,6 +21503,9 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__getattr__", 0);
 
   /* "View.MemoryView":234
@@ -11673,6 +21571,9 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__getitem__", 0);
 
   /* "View.MemoryView":237
@@ -11737,6 +21638,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struc
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__setitem__", 0);
 
   /* "View.MemoryView":240
@@ -11794,6 +21698,9 @@ static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __p
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
 
   /* "(tree fragment)":2
@@ -11848,6 +21755,9 @@ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
 
   /* "(tree fragment)":4
@@ -11895,6 +21805,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("array_cwrapper", 0);
 
   /* "View.MemoryView":248
@@ -12062,6 +21975,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -12223,6 +22139,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi
   int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
 
   /* "(tree fragment)":5
@@ -12448,6 +22367,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
 
   /* "(tree fragment)":17
@@ -12577,6 +22499,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -12657,6 +22582,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
   /* "View.MemoryView":346
@@ -13188,6 +23116,9 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
   PyObject *__pyx_t_5 = NULL;
   Py_ssize_t __pyx_t_6;
   char *__pyx_t_7;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("get_item_pointer", 0);
 
   /* "View.MemoryView":395
@@ -13335,6 +23266,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   char *__pyx_t_6;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__getitem__", 0);
 
   /* "View.MemoryView":404
@@ -13518,6 +23452,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__setitem__", 0);
   __Pyx_INCREF(__pyx_v_index);
 
@@ -13733,6 +23670,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
   int __pyx_t_9;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("is_slice", 0);
   __Pyx_INCREF(__pyx_v_obj);
 
@@ -13939,6 +23879,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   int __pyx_t_4;
   int __pyx_t_5;
   int __pyx_t_6;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
 
   /* "View.MemoryView":445
@@ -14035,6 +23978,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
   PyObject *__pyx_t_10 = NULL;
   PyObject *__pyx_t_11 = NULL;
   PyObject *__pyx_t_12 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
 
   /* "View.MemoryView":451
@@ -14308,6 +24254,9 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_
   __Pyx_RefNannyDeclarations
   char *__pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setitem_indexed", 0);
 
   /* "View.MemoryView":482
@@ -14377,6 +24326,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
   PyObject *__pyx_t_9 = NULL;
   size_t __pyx_t_10;
   int __pyx_t_11;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
 
   /* "View.MemoryView":488
@@ -14655,6 +24607,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   char *__pyx_t_12;
   char *__pyx_t_13;
   char *__pyx_t_14;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
 
   /* "View.MemoryView":504
@@ -14894,6 +24849,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu
   void *__pyx_t_6;
   int __pyx_t_7;
   Py_ssize_t __pyx_t_8;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   if (__pyx_v_info == NULL) {
     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
     return -1;
@@ -15230,6 +25188,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":554
@@ -15369,6 +25330,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru
   Py_ssize_t *__pyx_t_3;
   Py_ssize_t *__pyx_t_4;
   PyObject *__pyx_t_5 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":564
@@ -15448,6 +25412,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st
   Py_ssize_t *__pyx_t_4;
   Py_ssize_t *__pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":568
@@ -15559,6 +25526,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_
   Py_ssize_t *__pyx_t_4;
   Py_ssize_t *__pyx_t_5;
   Py_ssize_t *__pyx_t_6;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":576
@@ -15668,6 +25638,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":583
@@ -15728,6 +25701,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":587
@@ -15790,6 +25766,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":591
@@ -15865,6 +25844,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc
   Py_ssize_t *__pyx_t_4;
   Py_ssize_t *__pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
   /* "View.MemoryView":595
@@ -16078,6 +26060,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__repr__", 0);
 
   /* "View.MemoryView":612
@@ -16176,6 +26161,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__str__", 0);
 
   /* "View.MemoryView":616
@@ -16254,6 +26242,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16
   __Pyx_RefNannyDeclarations
   __Pyx_memviewslice *__pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("is_c_contig", 0);
 
   /* "View.MemoryView":622
@@ -16327,6 +26318,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18
   __Pyx_RefNannyDeclarations
   __Pyx_memviewslice *__pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("is_f_contig", 0);
 
   /* "View.MemoryView":628
@@ -16400,6 +26394,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20
   __Pyx_RefNannyDeclarations
   __Pyx_memviewslice __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("copy", 0);
 
   /* "View.MemoryView":633
@@ -16492,6 +26489,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22
   __Pyx_RefNannyDeclarations
   __Pyx_memviewslice __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("copy_fortran", 0);
 
   /* "View.MemoryView":645
@@ -16578,6 +26578,9 @@ static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struc
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
 
   /* "(tree fragment)":2
@@ -16632,6 +26635,9 @@ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED st
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
 
   /* "(tree fragment)":4
@@ -16677,6 +26683,9 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
 
   /* "View.MemoryView":658
@@ -16818,6 +26827,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   int __pyx_t_9;
   int __pyx_t_10;
   PyObject *__pyx_t_11 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_unellipsify", 0);
 
   /* "View.MemoryView":671
@@ -17260,6 +27272,9 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
   Py_ssize_t *__pyx_t_3;
   int __pyx_t_4;
   PyObject *__pyx_t_5 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
 
   /* "View.MemoryView":701
@@ -17367,6 +27382,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   Py_ssize_t __pyx_t_10;
   int __pyx_t_11;
   Py_ssize_t __pyx_t_12;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("memview_slice", 0);
 
   /* "View.MemoryView":711
@@ -17920,6 +27938,9 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
 
   /* "View.MemoryView":827
  *     cdef bint negative_step
@@ -18706,6 +28727,9 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("pybuffer_index", 0);
 
   /* "View.MemoryView":912
@@ -19016,6 +29040,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_t_7;
   int __pyx_t_8;
   int __pyx_t_9;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
 
   /* "View.MemoryView":944
  * @cname('__pyx_memslice_transpose')
@@ -19220,6 +29247,9 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
 
   /* "View.MemoryView":980
@@ -19304,6 +29334,9 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
   int __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
 
   /* "View.MemoryView":986
@@ -19446,6 +29479,9 @@ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
 
   /* "(tree fragment)":2
@@ -19500,6 +29536,9 @@ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUS
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
 
   /* "(tree fragment)":4
@@ -19553,6 +29592,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   Py_ssize_t *__pyx_t_7;
   Py_ssize_t *__pyx_t_8;
   Py_ssize_t __pyx_t_9;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
 
   /* "View.MemoryView":1007
@@ -19928,6 +29970,9 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   int __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
 
   /* "View.MemoryView":1055
@@ -20152,6 +30197,9 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("memoryview_copy", 0);
 
   /* "View.MemoryView":1083
@@ -20214,6 +30262,9 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   PyObject *(*__pyx_t_3)(char *);
   int (*__pyx_t_4)(char *, PyObject *);
   PyObject *__pyx_t_5 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
 
   /* "View.MemoryView":1094
@@ -21056,6 +31107,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   struct __pyx_memoryview_obj *__pyx_t_4;
   int __pyx_t_5;
   int __pyx_t_6;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
 
   /* "View.MemoryView":1219
  *     cdef void *result
@@ -21303,6 +31357,9 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   #ifdef WITH_THREAD
   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
   #endif
@@ -21388,6 +31445,9 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg,
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   #ifdef WITH_THREAD
   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
   #endif
@@ -21470,6 +31530,9 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   #ifdef WITH_THREAD
   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
   #endif
@@ -21587,6 +31650,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   int __pyx_t_6;
   void *__pyx_t_7;
   int __pyx_t_8;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
 
   /* "View.MemoryView":1276
  *     Check for overlapping memory and verify the shapes.
@@ -22663,6 +32729,9 @@ static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *_
   PyObject *__pyx_v___pyx_type = 0;
   long __pyx_v___pyx_checksum;
   PyObject *__pyx_v___pyx_state = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
@@ -22740,6 +32809,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   int __pyx_t_6;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
 
   /* "(tree fragment)":4
@@ -22928,6 +33000,9 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__
   PyObject *__pyx_t_6 = NULL;
   PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
 
   /* "(tree fragment)":12
@@ -23069,9 +33144,9 @@ static void __pyx_tp_dealloc_array(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
+    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
     __pyx_array___dealloc__(o);
-    --Py_REFCNT(o);
+    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->mode);
@@ -23380,9 +33455,9 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
+    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
     __pyx_memoryview___dealloc__(o);
-    --Py_REFCNT(o);
+    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->obj);
@@ -23630,9 +33705,9 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
+    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
     __pyx_memoryviewslice___dealloc__(o);
-    --Py_REFCNT(o);
+    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->from_object);
@@ -23829,10 +33904,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
   {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
+  {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
+  {&__pyx_n_s_base_tdoa, __pyx_k_base_tdoa, sizeof(__pyx_k_base_tdoa), 0, 0, 1, 1},
   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
   {&__pyx_n_s_c_corr, __pyx_k_c_corr, sizeof(__pyx_k_c_corr), 0, 0, 1, 1},
+  {&__pyx_n_s_c_corr_all, __pyx_k_c_corr_all, sizeof(__pyx_k_c_corr_all), 0, 0, 1, 1},
+  {&__pyx_n_s_c_corr_at, __pyx_k_c_corr_at, sizeof(__pyx_k_c_corr_at), 0, 0, 1, 1},
+  {&__pyx_n_s_c_corr_core2, __pyx_k_c_corr_core2, sizeof(__pyx_k_c_corr_core2), 0, 0, 1, 1},
   {&__pyx_kp_s_c_corr_pyx, __pyx_k_c_corr_pyx, sizeof(__pyx_k_c_corr_pyx), 0, 0, 1, 0},
   {&__pyx_n_s_cc, __pyx_k_cc, sizeof(__pyx_k_cc), 0, 0, 1, 1},
   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
@@ -23840,12 +33920,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
   {&__pyx_n_s_corr_val, __pyx_k_corr_val, sizeof(__pyx_k_corr_val), 0, 0, 1, 1},
+  {&__pyx_n_s_curr_tdoa, __pyx_k_curr_tdoa, sizeof(__pyx_k_curr_tdoa), 0, 0, 1, 1},
   {&__pyx_n_s_defaults, __pyx_k_defaults, sizeof(__pyx_k_defaults), 0, 0, 1, 1},
   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
   {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
   {&__pyx_kp_s_double_int, __pyx_k_double_int, sizeof(__pyx_k_double_int), 0, 0, 1, 0},
   {&__pyx_kp_s_double_long, __pyx_k_double_long, sizeof(__pyx_k_double_long), 0, 0, 1, 0},
-  {&__pyx_kp_s_double_long_long, __pyx_k_double_long_long, sizeof(__pyx_k_double_long_long), 0, 0, 1, 0},
   {&__pyx_kp_s_double_short, __pyx_k_double_short, sizeof(__pyx_k_double_short), 0, 0, 1, 0},
   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
@@ -23854,9 +33934,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
   {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
+  {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
   {&__pyx_kp_s_float_int, __pyx_k_float_int, sizeof(__pyx_k_float_int), 0, 0, 1, 0},
   {&__pyx_kp_s_float_long, __pyx_k_float_long, sizeof(__pyx_k_float_long), 0, 0, 1, 0},
-  {&__pyx_kp_s_float_long_long, __pyx_k_float_long_long, sizeof(__pyx_k_float_long_long), 0, 0, 1, 0},
   {&__pyx_kp_s_float_short, __pyx_k_float_short, sizeof(__pyx_k_float_short), 0, 0, 1, 0},
   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
@@ -23864,32 +33944,32 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
   {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
   {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
+  {&__pyx_n_s_i0, __pyx_k_i0, sizeof(__pyx_k_i0), 0, 0, 1, 1},
   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+  {&__pyx_n_s_ind_tdoa, __pyx_k_ind_tdoa, sizeof(__pyx_k_ind_tdoa), 0, 0, 1, 1},
   {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
   {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
   {&__pyx_kp_s_int_int, __pyx_k_int_int, sizeof(__pyx_k_int_int), 0, 0, 1, 0},
   {&__pyx_kp_s_int_long, __pyx_k_int_long, sizeof(__pyx_k_int_long), 0, 0, 1, 0},
-  {&__pyx_kp_s_int_long_long, __pyx_k_int_long_long, sizeof(__pyx_k_int_long_long), 0, 0, 1, 0},
   {&__pyx_kp_s_int_short, __pyx_k_int_short, sizeof(__pyx_k_int_short), 0, 0, 1, 0},
   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
   {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
+  {&__pyx_n_s_j0, __pyx_k_j0, sizeof(__pyx_k_j0), 0, 0, 1, 1},
   {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1},
   {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
+  {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
   {&__pyx_n_s_log10, __pyx_k_log10, sizeof(__pyx_k_log10), 0, 0, 1, 1},
   {&__pyx_n_s_long, __pyx_k_long, sizeof(__pyx_k_long), 0, 0, 1, 1},
   {&__pyx_kp_s_long_int, __pyx_k_long_int, sizeof(__pyx_k_long_int), 0, 0, 1, 0},
   {&__pyx_kp_s_long_long, __pyx_k_long_long, sizeof(__pyx_k_long_long), 0, 0, 1, 0},
-  {&__pyx_kp_s_long_long_2, __pyx_k_long_long_2, sizeof(__pyx_k_long_long_2), 0, 0, 1, 0},
-  {&__pyx_kp_s_long_long_int, __pyx_k_long_long_int, sizeof(__pyx_k_long_long_int), 0, 0, 1, 0},
-  {&__pyx_kp_s_long_long_long, __pyx_k_long_long_long, sizeof(__pyx_k_long_long_long), 0, 0, 1, 0},
-  {&__pyx_kp_s_long_long_long_2, __pyx_k_long_long_long_2, sizeof(__pyx_k_long_long_long_2), 0, 0, 1, 0},
-  {&__pyx_kp_s_long_long_long_long, __pyx_k_long_long_long_long, sizeof(__pyx_k_long_long_long_long), 0, 0, 1, 0},
-  {&__pyx_kp_s_long_long_short, __pyx_k_long_long_short, sizeof(__pyx_k_long_long_short), 0, 0, 1, 0},
   {&__pyx_kp_s_long_short, __pyx_k_long_short, sizeof(__pyx_k_long_short), 0, 0, 1, 0},
   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
   {&__pyx_n_s_max_corr_val, __pyx_k_max_corr_val, sizeof(__pyx_k_max_corr_val), 0, 0, 1, 1},
+  {&__pyx_n_s_max_tdoa, __pyx_k_max_tdoa, sizeof(__pyx_k_max_tdoa), 0, 0, 1, 1},
   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
+  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
   {&__pyx_n_s_n_pair, __pyx_k_n_pair, sizeof(__pyx_k_n_pair), 0, 0, 1, 1},
   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
@@ -23900,11 +33980,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
+  {&__pyx_n_s_out_taus, __pyx_k_out_taus, sizeof(__pyx_k_out_taus), 0, 0, 1, 1},
   {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
+  {&__pyx_n_s_pyx_fuse_0c_corr_all, __pyx_k_pyx_fuse_0c_corr_all, sizeof(__pyx_k_pyx_fuse_0c_corr_all), 0, 0, 1, 1},
+  {&__pyx_n_s_pyx_fuse_1c_corr_all, __pyx_k_pyx_fuse_1c_corr_all, sizeof(__pyx_k_pyx_fuse_1c_corr_all), 0, 0, 1, 1},
+  {&__pyx_n_s_pyx_fuse_2c_corr_all, __pyx_k_pyx_fuse_2c_corr_all, sizeof(__pyx_k_pyx_fuse_2c_corr_all), 0, 0, 1, 1},
   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
@@ -23922,7 +34006,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s_short, __pyx_k_short, sizeof(__pyx_k_short), 0, 0, 1, 1},
   {&__pyx_kp_s_short_int, __pyx_k_short_int, sizeof(__pyx_k_short_int), 0, 0, 1, 0},
   {&__pyx_kp_s_short_long, __pyx_k_short_long, sizeof(__pyx_k_short_long), 0, 0, 1, 0},
-  {&__pyx_kp_s_short_long_long, __pyx_k_short_long_long, sizeof(__pyx_k_short_long_long), 0, 0, 1, 0},
   {&__pyx_kp_s_short_short, __pyx_k_short_short, sizeof(__pyx_k_short_short), 0, 0, 1, 0},
   {&__pyx_n_s_signatures, __pyx_k_signatures, sizeof(__pyx_k_signatures), 0, 0, 1, 1},
   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
@@ -23938,16 +34021,22 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
   {&__pyx_n_s_taus, __pyx_k_taus, sizeof(__pyx_k_taus), 0, 0, 1, 1},
   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+  {&__pyx_n_s_tmp_val, __pyx_k_tmp_val, sizeof(__pyx_k_tmp_val), 0, 0, 1, 1},
   {&__pyx_n_s_total, __pyx_k_total, sizeof(__pyx_k_total), 0, 0, 1, 1},
   {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
   {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
+  {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
+  {&__pyx_n_s_win_size, __pyx_k_win_size, sizeof(__pyx_k_win_size), 0, 0, 1, 1},
+  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
   {0, 0, 0, 0, 0, 0, 0}
 };
 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 23, __pyx_L1_error)
-  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 22, __pyx_L1_error)
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 22, __pyx_L1_error)
+  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 106, __pyx_L1_error)
+  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 107, __pyx_L1_error)
   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error)
   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
@@ -23963,17 +34052,17 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
-  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_No_matching_signature_found); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_No_matching_signature_found); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_tuple__3);
   __Pyx_GIVEREF(__pyx_tuple__3);
-  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Function_call_with_ambiguous_arg); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Function_call_with_ambiguous_arg); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_tuple__4);
   __Pyx_GIVEREF(__pyx_tuple__4);
 
@@ -24169,17 +34258,41 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
   __Pyx_GOTREF(__pyx_tuple__22);
   __Pyx_GIVEREF(__pyx_tuple__22);
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
-  __pyx_tuple__23 = PyTuple_Pack(9, __pyx_n_s_cc, __pyx_n_s_taus, __pyx_n_s_total, __pyx_n_s_n_pair, __pyx_n_s_max_corr_val, __pyx_n_s_index, __pyx_n_s_corr_val, __pyx_n_s_i, __pyx_n_s_p); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_tuple__23 = PyTuple_Pack(9, __pyx_n_s_cc, __pyx_n_s_taus, __pyx_n_s_total, __pyx_n_s_n_pair, __pyx_n_s_max_corr_val, __pyx_n_s_index, __pyx_n_s_corr_val, __pyx_n_s_i, __pyx_n_s_p); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_tuple__23);
   __Pyx_GIVEREF(__pyx_tuple__23);
-  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 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_c_corr_pyx, __pyx_n_s_c_corr, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 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_c_corr_pyx, __pyx_n_s_c_corr_at, 22, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 22, __pyx_L1_error)
+
+  /* "c_corr.pyx":41
+ * @cython.wraparound(False)
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):             # <<<<<<<<<<<<<<
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ */
+  __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_cc, __pyx_n_s_max_tdoa, __pyx_n_s_base_tdoa); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__25);
+  __Pyx_GIVEREF(__pyx_tuple__25);
+  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_corr_pyx, __pyx_n_s_pyx_fuse_0c_corr_all, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 41, __pyx_L1_error)
+
+  /* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+  __pyx_tuple__27 = PyTuple_Pack(14, __pyx_n_s_cc, __pyx_n_s_taus, __pyx_n_s_out_taus, __pyx_n_s_val, __pyx_n_s_curr_tdoa, __pyx_n_s_ind_tdoa, __pyx_n_s_max_tdoa, __pyx_n_s_win_size, __pyx_n_s_n_pair, __pyx_n_s_i0, __pyx_n_s_j0, __pyx_n_s_tmp_val, __pyx_n_s_i, __pyx_n_s_level); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 96, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__27);
+  __Pyx_GIVEREF(__pyx_tuple__27);
+  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(9, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_corr_pyx, __pyx_n_s_c_corr_core2, 96, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 96, __pyx_L1_error)
 
   /* "View.MemoryView":286
  *         return self.name
@@ -24188,9 +34301,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 286, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__25);
-  __Pyx_GIVEREF(__pyx_tuple__25);
+  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 286, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__29);
+  __Pyx_GIVEREF(__pyx_tuple__29);
 
   /* "View.MemoryView":287
  * 
@@ -24199,9 +34312,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 287, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__26);
-  __Pyx_GIVEREF(__pyx_tuple__26);
+  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 287, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__30);
+  __Pyx_GIVEREF(__pyx_tuple__30);
 
   /* "View.MemoryView":288
  * cdef generic = Enum("<strided and direct or indirect>")
@@ -24210,9 +34323,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 288, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__27);
-  __Pyx_GIVEREF(__pyx_tuple__27);
+  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 288, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__31);
+  __Pyx_GIVEREF(__pyx_tuple__31);
 
   /* "View.MemoryView":291
  * 
@@ -24221,9 +34334,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 291, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__28);
-  __Pyx_GIVEREF(__pyx_tuple__28);
+  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 291, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__32);
+  __Pyx_GIVEREF(__pyx_tuple__32);
 
   /* "View.MemoryView":292
  * 
@@ -24232,19 +34345,19 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 292, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__29);
-  __Pyx_GIVEREF(__pyx_tuple__29);
+  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 292, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__33);
+  __Pyx_GIVEREF(__pyx_tuple__33);
 
   /* "(tree fragment)":1
  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
  *     cdef object __pyx_PickleError
  *     cdef object __pyx_result
  */
-  __pyx_tuple__30 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 1, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__30);
-  __Pyx_GIVEREF(__pyx_tuple__30);
-  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(1, 1, __pyx_L1_error)
+  __pyx_tuple__34 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 1, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__34);
+  __Pyx_GIVEREF(__pyx_tuple__34);
+  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(1, 1, __pyx_L1_error)
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -24257,6 +34370,8 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
+  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
+  __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) __PYX_ERR(0, 1, __pyx_L1_error)
   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
   return 0;
@@ -24303,6 +34418,9 @@ static int __Pyx_modinit_function_export_code(void) {
 
 static int __Pyx_modinit_type_init_code(void) {
   __Pyx_RefNannyDeclarations
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
   /*--- Type init code ---*/
   __pyx_vtabptr_array = &__pyx_vtable_array;
@@ -24388,17 +34506,19 @@ static int __Pyx_modinit_function_import_code(void) {
 }
 
 
-#if PY_MAJOR_VERSION < 3
-#ifdef CYTHON_NO_PYINIT_EXPORT
-#define __Pyx_PyMODINIT_FUNC void
-#else
+#ifndef CYTHON_NO_PYINIT_EXPORT
 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
+#elif PY_MAJOR_VERSION < 3
+#ifdef __cplusplus
+#define __Pyx_PyMODINIT_FUNC extern "C" void
+#else
+#define __Pyx_PyMODINIT_FUNC void
 #endif
 #else
-#ifdef CYTHON_NO_PYINIT_EXPORT
-#define __Pyx_PyMODINIT_FUNC PyObject *
+#ifdef __cplusplus
+#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
 #else
-#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
+#define __Pyx_PyMODINIT_FUNC PyObject *
 #endif
 #endif
 
@@ -24481,8 +34601,10 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_c_corr(PyObject *__pyx_pyinit_modu
 {
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  static PyThread_type_lock __pyx_t_4[8];
+  static PyThread_type_lock __pyx_t_3[8];
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_PEP489_MULTI_PHASE_INIT
   if (__pyx_m) {
@@ -24530,11 +34652,9 @@ if (!__Pyx_RefNanny) {
   #endif
   /*--- Library function declarations ---*/
   /*--- Threads initialization code ---*/
-  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
-  #ifdef WITH_THREAD /* Python build with threading support? */
+  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
   PyEval_InitThreads();
   #endif
-  #endif
   /*--- Module creation code ---*/
   #if CYTHON_PEP489_MULTI_PHASE_INIT
   __pyx_m = __pyx_pyinit_module;
@@ -24571,14 +34691,14 @@ if (!__Pyx_RefNanny) {
   }
   #endif
   /*--- Builtin init code ---*/
-  if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
+  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
   /*--- Constants init code ---*/
-  if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
+  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
   /*--- Global type/function init code ---*/
   (void)__Pyx_modinit_global_init_code();
   (void)__Pyx_modinit_variable_export_code();
   (void)__Pyx_modinit_function_export_code();
-  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
+  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
   (void)__Pyx_modinit_type_import_code();
   (void)__Pyx_modinit_variable_import_code();
   (void)__Pyx_modinit_function_import_code();
@@ -24593,146 +34713,228 @@ if (!__Pyx_RefNanny) {
  * cimport cython
  * 
  */
-  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
+  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "c_corr.pyx":23
- * @cython.boundscheck(False)
+  /* "c_corr.pyx":22
  * @cython.wraparound(False)
- * def c_corr(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
+ * @cython.embedsignature(True)
+ * def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):             # <<<<<<<<<<<<<<
  *     total = taus.shape[1]
  *     n_pair = taus.shape[0]
  */
-  __pyx_t_1 = __Pyx_PyDict_NewPresized(24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_1 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_0__pyx_mdef_6c_corr_3c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_0_0__pyx_mdef_6c_corr_7c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_short, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_0_1__pyx_mdef_6c_corr_9c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_int, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_0_2__pyx_mdef_6c_corr_11c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_long, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_1_0__pyx_mdef_6c_corr_13c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_short, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_short, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_1__pyx_mdef_6c_corr_5c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_1_1__pyx_mdef_6c_corr_15c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_int, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_int, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_2__pyx_mdef_6c_corr_7c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_1_2__pyx_mdef_6c_corr_17c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_long, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_3__pyx_mdef_6c_corr_9c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_2_0__pyx_mdef_6c_corr_19c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_long_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_short, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_0__pyx_mdef_6c_corr_11c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_2_1__pyx_mdef_6c_corr_21c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_short, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_int, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_1__pyx_mdef_6c_corr_13c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_2_2__pyx_mdef_6c_corr_23c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_int, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_long, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_2__pyx_mdef_6c_corr_15c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_3_0__pyx_mdef_6c_corr_25c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_short, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_3__pyx_mdef_6c_corr_17c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_3_1__pyx_mdef_6c_corr_27c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_long_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_int, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_2_0__pyx_mdef_6c_corr_19c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_3_2__pyx_mdef_6c_corr_29c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_short, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_long, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_2_1__pyx_mdef_6c_corr_21c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_4_0__pyx_mdef_6c_corr_31c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_short, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_4_1__pyx_mdef_6c_corr_33c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_int, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_4_2__pyx_mdef_6c_corr_35c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_long, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_mdef_6c_corr_1c_corr_at, 0, __pyx_n_s_c_corr_at, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
+  ((__pyx_FusedFunctionObject *) __pyx_t_2)->__signatures__ = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_corr_at, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "c_corr.pyx":41
+ * @cython.wraparound(False)
+ * @cython.embedsignature(True)
+ * cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):             # <<<<<<<<<<<<<<
+ *     cdef float[:,::1] cc_mem = cc.astype(np.float32)
+ *     cdef double corr_val = 0.0
+ */
+  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_fuse_0__pyx_mdef_6c_corr_39__pyx_fuse_0c_corr_all, 0, __pyx_n_s_pyx_fuse_0c_corr_all, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_short, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_fuse_1__pyx_mdef_6c_corr_41__pyx_fuse_1c_corr_all, 0, __pyx_n_s_pyx_fuse_1c_corr_all, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_int, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_fuse_2__pyx_mdef_6c_corr_43__pyx_fuse_2c_corr_all, 0, __pyx_n_s_pyx_fuse_2c_corr_all, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_empty_tuple);
+  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_long, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_mdef_6c_corr_3c_corr_all, 0, __pyx_n_s_c_corr_all, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __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_2;
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_corr_all, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "c_corr.pyx":96
+ * @cython.wraparound(False)
+ * @cython.profile(True)
+ * def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,             # <<<<<<<<<<<<<<
+ *                  npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+ *     cdef int i0 = 1
+ */
+  __pyx_t_1 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_0_0__pyx_mdef_6c_corr_47_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_int, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_short, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_2_2__pyx_mdef_6c_corr_23c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_0_1__pyx_mdef_6c_corr_49_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_long_2, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_int, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_2_3__pyx_mdef_6c_corr_25c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_0_2__pyx_mdef_6c_corr_51_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_long_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_short_long, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_3_0__pyx_mdef_6c_corr_27c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_1_0__pyx_mdef_6c_corr_53_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_long_short, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_short, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_3_1__pyx_mdef_6c_corr_29c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_1_1__pyx_mdef_6c_corr_55_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_long_int, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_int, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_3_2__pyx_mdef_6c_corr_31c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_1_2__pyx_mdef_6c_corr_57_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_long_long_2, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_int_long, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_3_3__pyx_mdef_6c_corr_33c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_2_0__pyx_mdef_6c_corr_59_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_long_long_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_short, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_4_0__pyx_mdef_6c_corr_35c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_2_1__pyx_mdef_6c_corr_61_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_short, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_int, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_4_1__pyx_mdef_6c_corr_37c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_2_2__pyx_mdef_6c_corr_63_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_int, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_long_long, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_4_2__pyx_mdef_6c_corr_39c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_3_0__pyx_mdef_6c_corr_65_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_short, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_4_3__pyx_mdef_6c_corr_41c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_3_1__pyx_mdef_6c_corr_67_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_long_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_int, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_5_0__pyx_mdef_6c_corr_43c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_3_2__pyx_mdef_6c_corr_69_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_short, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_float_long, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_5_1__pyx_mdef_6c_corr_45c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_4_0__pyx_mdef_6c_corr_71_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_int, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_short, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_5_2__pyx_mdef_6c_corr_47c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_4_1__pyx_mdef_6c_corr_73_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_int, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_5_3__pyx_mdef_6c_corr_49c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_fuse_4_2__pyx_mdef_6c_corr_75_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
-  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_long_long, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_double_long, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_mdef_6c_corr_1c_corr, 0, __pyx_n_s_c_corr, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_2 = __pyx_FusedFunction_New(&__pyx_mdef_6c_corr_5_c_corr_core2, 0, __pyx_n_s_c_corr_core2, NULL, __pyx_n_s_c_corr, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple);
   ((__pyx_FusedFunctionObject *) __pyx_t_2)->__signatures__ = __pyx_t_1;
   __Pyx_GIVEREF(__pyx_t_1);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_corr, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+  __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_corr_core2, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   /* "c_corr.pyx":1
@@ -24740,10 +34942,10 @@ if (!__Pyx_RefNanny) {
  * import numpy as np
  * cimport cython
  */
-  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __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;
 
   /* "View.MemoryView":209
  *         info.obj = self
@@ -24752,10 +34954,10 @@ if (!__Pyx_RefNanny) {
  * 
  *     def __dealloc__(array self):
  */
-  __pyx_t_3 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 209, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_3) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 209, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   PyType_Modified(__pyx_array_type);
 
   /* "View.MemoryView":286
@@ -24765,12 +34967,12 @@ if (!__Pyx_RefNanny) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 286, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 286, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF_SET(generic, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __Pyx_DECREF_SET(generic, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
 
   /* "View.MemoryView":287
  * 
@@ -24779,12 +34981,12 @@ if (!__Pyx_RefNanny) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 287, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF_SET(strided, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __Pyx_DECREF_SET(strided, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
 
   /* "View.MemoryView":288
  * cdef generic = Enum("<strided and direct or indirect>")
@@ -24793,12 +34995,12 @@ if (!__Pyx_RefNanny) {
  * 
  * 
  */
-  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 288, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 288, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF_SET(indirect, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __Pyx_DECREF_SET(indirect, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
 
   /* "View.MemoryView":291
  * 
@@ -24807,12 +35009,12 @@ if (!__Pyx_RefNanny) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 291, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 291, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF_SET(contiguous, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __Pyx_DECREF_SET(contiguous, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
 
   /* "View.MemoryView":292
  * 
@@ -24821,12 +35023,12 @@ if (!__Pyx_RefNanny) {
  * 
  * 
  */
-  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 292, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 292, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
 
   /* "View.MemoryView":316
  * 
@@ -24844,15 +35046,15 @@ if (!__Pyx_RefNanny) {
  *     PyThread_allocate_lock(),
  *     PyThread_allocate_lock(),
  */
-  __pyx_t_4[0] = PyThread_allocate_lock();
-  __pyx_t_4[1] = PyThread_allocate_lock();
-  __pyx_t_4[2] = PyThread_allocate_lock();
-  __pyx_t_4[3] = PyThread_allocate_lock();
-  __pyx_t_4[4] = PyThread_allocate_lock();
-  __pyx_t_4[5] = PyThread_allocate_lock();
-  __pyx_t_4[6] = PyThread_allocate_lock();
-  __pyx_t_4[7] = PyThread_allocate_lock();
-  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
+  __pyx_t_3[0] = PyThread_allocate_lock();
+  __pyx_t_3[1] = PyThread_allocate_lock();
+  __pyx_t_3[2] = PyThread_allocate_lock();
+  __pyx_t_3[3] = PyThread_allocate_lock();
+  __pyx_t_3[4] = PyThread_allocate_lock();
+  __pyx_t_3[5] = PyThread_allocate_lock();
+  __pyx_t_3[6] = PyThread_allocate_lock();
+  __pyx_t_3[7] = PyThread_allocate_lock();
+  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
 
   /* "View.MemoryView":549
  *         info.obj = self
@@ -24861,10 +35063,10 @@ if (!__Pyx_RefNanny) {
  * 
  * 
  */
-  __pyx_t_3 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 549, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_3) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 549, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   PyType_Modified(__pyx_memoryview_type);
 
   /* "View.MemoryView":995
@@ -24874,10 +35076,10 @@ if (!__Pyx_RefNanny) {
  * 
  * 
  */
-  __pyx_t_3 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 995, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_3) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 995, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   PyType_Modified(__pyx_memoryviewslice_type);
 
   /* "(tree fragment)":1
@@ -24885,10 +35087,10 @@ if (!__Pyx_RefNanny) {
  *     cdef object __pyx_PickleError
  *     cdef object __pyx_result
  */
-  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   /* "(tree fragment)":11
  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
@@ -24904,7 +35106,6 @@ if (!__Pyx_RefNanny) {
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   if (__pyx_m) {
     if (__pyx_d) {
       __Pyx_AddTraceback("init c_corr", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -25032,7 +35233,7 @@ static int __Pyx_ParseOptionalKeywords(
         }
         name = first_kw_arg;
         #if PY_MAJOR_VERSION < 3
-        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+        if (likely(PyString_Check(key))) {
             while (*name) {
                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                         && _PyString_Eq(**name, key)) {
@@ -25059,7 +35260,7 @@ static int __Pyx_ParseOptionalKeywords(
             while (*name) {
                 int cmp = (**name == key) ? 0 :
                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                 #endif
                     PyUnicode_Compare(**name, key);
                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
@@ -25075,7 +35276,7 @@ static int __Pyx_ParseOptionalKeywords(
                 while (argname != first_kw_arg) {
                     int cmp = (**argname == key) ? 0 :
                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                     #endif
                         PyUnicode_Compare(**argname, key);
                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
@@ -25282,7 +35483,7 @@ done:
 #if CYTHON_COMPILING_IN_CPYTHON
 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
     PyObject *result;
-    ternaryfunc call = func->ob_type->tp_call;
+    ternaryfunc call = Py_TYPE(func)->tp_call;
     if (unlikely(!call))
         return PyObject_Call(func, arg, kw);
     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
@@ -25340,7 +35541,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec
         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
             return __Pyx_PyObject_CallMethO(func, arg);
 #if CYTHON_FAST_PYCCALL
-        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
+        } else if (__Pyx_PyFastCFunction_Check(func)) {
             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
 #endif
         }
@@ -25593,7 +35794,7 @@ static long __Pyx__PyObject_Ord(PyObject* c) {
 #endif
     } else {
         PyErr_Format(PyExc_TypeError,
-            "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name);
+            "ord() expected string of length 1, but %.200s found", Py_TYPE(c)->tp_name);
         return (long)(Py_UCS4)-1;
     }
     PyErr_Format(PyExc_TypeError,
@@ -26213,7 +36414,7 @@ __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
     int i, retval=-1;
     Py_buffer *buf = &memview->view;
     __Pyx_RefNannySetupContext("init_memviewslice", 0);
-    if (memviewslice->memview || memviewslice->data) {
+    if (unlikely(memviewslice->memview || memviewslice->data)) {
         PyErr_SetString(PyExc_ValueError,
             "memviewslice is already initialized!");
         goto fail;
@@ -26292,13 +36493,13 @@ __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
 {
     int first_time;
     struct __pyx_memoryview_obj *memview = memslice->memview;
-    if (!memview || (PyObject *) memview == Py_None)
+    if (unlikely(!memview || (PyObject *) memview == Py_None))
         return;
-    if (__pyx_get_slice_count(memview) < 0)
+    if (unlikely(__pyx_get_slice_count(memview) < 0))
         __pyx_fatalerror("Acquisition count is %d (line %d)",
                          __pyx_get_slice_count(memview), lineno);
     first_time = __pyx_add_acquisition_count(memview) == 0;
-    if (first_time) {
+    if (unlikely(first_time)) {
         if (have_gil) {
             Py_INCREF((PyObject *) memview);
         } else {
@@ -26312,18 +36513,16 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
                                              int have_gil, int lineno) {
     int last_time;
     struct __pyx_memoryview_obj *memview = memslice->memview;
-    if (!memview ) {
-        return;
-    } else if ((PyObject *) memview == Py_None) {
+    if (unlikely(!memview || (PyObject *) memview == Py_None)) {
         memslice->memview = NULL;
         return;
     }
-    if (__pyx_get_slice_count(memview) <= 0)
+    if (unlikely(__pyx_get_slice_count(memview) <= 0))
         __pyx_fatalerror("Acquisition count is %d (line %d)",
                          __pyx_get_slice_count(memview), lineno);
     last_time = __pyx_sub_acquisition_count(memview) == 1;
     memslice->data = NULL;
-    if (last_time) {
+    if (unlikely(last_time)) {
         if (have_gil) {
             Py_CLEAR(memslice->memview);
         } else {
@@ -26336,6 +36535,264 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
     }
 }
 
+/* Profile */
+#if CYTHON_PROFILE
+static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
+                                   PyFrameObject** frame,
+                                   PyThreadState* tstate,
+                                   const char *funcname,
+                                   const char *srcfile,
+                                   int firstlineno) {
+    PyObject *type, *value, *traceback;
+    int retval;
+    if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
+        if (*code == NULL) {
+            *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
+            if (*code == NULL) return 0;
+        }
+        *frame = PyFrame_New(
+            tstate,                          /*PyThreadState *tstate*/
+            *code,                           /*PyCodeObject *code*/
+            __pyx_d,                  /*PyObject *globals*/
+            0                                /*PyObject *locals*/
+        );
+        if (*frame == NULL) return 0;
+        if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
+            Py_INCREF(Py_None);
+            (*frame)->f_trace = Py_None;
+        }
+#if PY_VERSION_HEX < 0x030400B1
+    } else {
+        (*frame)->f_tstate = tstate;
+#endif
+    }
+    __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
+    retval = 1;
+    tstate->tracing++;
+    __Pyx_SetTracing(tstate, 0);
+    __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
+    #if CYTHON_TRACE
+    if (tstate->c_tracefunc)
+        retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
+    if (retval && tstate->c_profilefunc)
+    #endif
+        retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
+    __Pyx_SetTracing(tstate, (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc)));
+    tstate->tracing--;
+    if (retval) {
+        __Pyx_ErrRestoreInState(tstate, type, value, traceback);
+        return __Pyx_IsTracing(tstate, 0, 0) && retval;
+    } else {
+        Py_XDECREF(type);
+        Py_XDECREF(value);
+        Py_XDECREF(traceback);
+        return -1;
+    }
+}
+static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
+    PyCodeObject *py_code = 0;
+#if PY_MAJOR_VERSION >= 3
+    py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
+    if (likely(py_code)) {
+        py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
+    }
+#else
+    PyObject *py_srcfile = 0;
+    PyObject *py_funcname = 0;
+    py_funcname = PyString_FromString(funcname);
+    if (unlikely(!py_funcname)) goto bad;
+    py_srcfile = PyString_FromString(srcfile);
+    if (unlikely(!py_srcfile)) goto bad;
+    py_code = PyCode_New(
+        0,
+        0,
+        0,
+        CO_OPTIMIZED | CO_NEWLOCALS,
+        __pyx_empty_bytes,     /*PyObject *code,*/
+        __pyx_empty_tuple,     /*PyObject *consts,*/
+        __pyx_empty_tuple,     /*PyObject *names,*/
+        __pyx_empty_tuple,     /*PyObject *varnames,*/
+        __pyx_empty_tuple,     /*PyObject *freevars,*/
+        __pyx_empty_tuple,     /*PyObject *cellvars,*/
+        py_srcfile,       /*PyObject *filename,*/
+        py_funcname,      /*PyObject *name,*/
+        firstlineno,
+        __pyx_empty_bytes      /*PyObject *lnotab*/
+    );
+bad:
+    Py_XDECREF(py_srcfile);
+    Py_XDECREF(py_funcname);
+#endif
+    return py_code;
+}
+#endif
+
+/* WriteUnraisableException */
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
+                                  int full_traceback, CYTHON_UNUSED int nogil) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_PyThreadState_declare
+#ifdef WITH_THREAD
+    PyGILState_STATE state;
+    if (nogil)
+        state = PyGILState_Ensure();
+#ifdef _MSC_VER
+    else state = (PyGILState_STATE)-1;
+#endif
+#endif
+    __Pyx_PyThreadState_assign
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    if (full_traceback) {
+        Py_XINCREF(old_exc);
+        Py_XINCREF(old_val);
+        Py_XINCREF(old_tb);
+        __Pyx_ErrRestore(old_exc, old_val, old_tb);
+        PyErr_PrintEx(1);
+    }
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+#ifdef WITH_THREAD
+    if (nogil)
+        PyGILState_Release(state);
+#endif
+}
+
+/* PyIntBinop */
+#if !CYTHON_COMPILING_IN_PYPY
+static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
+    (void)inplace;
+    (void)zerodivision_check;
+    #if PY_MAJOR_VERSION < 3
+    if (likely(PyInt_CheckExact(op1))) {
+        const long b = intval;
+        long x;
+        long a = PyInt_AS_LONG(op1);
+            x = (long)((unsigned long)a - b);
+            if (likely((x^a) >= 0 || (x^~b) >= 0))
+                return PyInt_FromLong(x);
+            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
+    }
+    #endif
+    #if CYTHON_USE_PYLONG_INTERNALS
+    if (likely(PyLong_CheckExact(op1))) {
+        const long b = intval;
+        long a, x;
+#ifdef HAVE_LONG_LONG
+        const PY_LONG_LONG llb = intval;
+        PY_LONG_LONG lla, llx;
+#endif
+        const digit* digits = ((PyLongObject*)op1)->ob_digit;
+        const Py_ssize_t size = Py_SIZE(op1);
+        if (likely(__Pyx_sst_abs(size) <= 1)) {
+            a = likely(size) ? digits[0] : 0;
+            if (size == -1) a = -a;
+        } else {
+            switch (size) {
+                case -2:
+                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+                        break;
+#ifdef HAVE_LONG_LONG
+                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
+                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+                        goto long_long;
+#endif
+                    }
+                    CYTHON_FALLTHROUGH;
+                case 2:
+                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
+                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+                        break;
+#ifdef HAVE_LONG_LONG
+                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
+                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+                        goto long_long;
+#endif
+                    }
+                    CYTHON_FALLTHROUGH;
+                case -3:
+                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+                        break;
+#ifdef HAVE_LONG_LONG
+                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
+                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+                        goto long_long;
+#endif
+                    }
+                    CYTHON_FALLTHROUGH;
+                case 3:
+                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
+                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+                        break;
+#ifdef HAVE_LONG_LONG
+                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
+                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+                        goto long_long;
+#endif
+                    }
+                    CYTHON_FALLTHROUGH;
+                case -4:
+                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+                        break;
+#ifdef HAVE_LONG_LONG
+                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
+                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+                        goto long_long;
+#endif
+                    }
+                    CYTHON_FALLTHROUGH;
+                case 4:
+                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
+                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
+                        break;
+#ifdef HAVE_LONG_LONG
+                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
+                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
+                        goto long_long;
+#endif
+                    }
+                    CYTHON_FALLTHROUGH;
+                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
+            }
+        }
+                x = a - b;
+            return PyLong_FromLong(x);
+#ifdef HAVE_LONG_LONG
+        long_long:
+                llx = lla - llb;
+            return PyLong_FromLongLong(llx);
+#endif
+        
+        
+    }
+    #endif
+    if (PyFloat_CheckExact(op1)) {
+        const long b = intval;
+        double a = PyFloat_AS_DOUBLE(op1);
+            double result;
+            PyFPE_START_PROTECT("subtract", return NULL)
+            result = ((double)a) - (double)b;
+            PyFPE_END_PROTECT(result)
+            return PyFloat_FromDouble(result);
+    }
+    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
+}
+#endif
+
 /* ArgTypeTest */
 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
 {
@@ -26578,9 +37035,9 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         if (stop < 0)
             stop += length;
     }
+    if (unlikely(stop <= start))
+        return __Pyx_NewRef(__pyx_empty_unicode);
     length = stop - start;
-    if (unlikely(length <= 0))
-        return PyUnicode_FromUnicode(NULL, 0);
     cstring += start;
     if (decode_func) {
         return decode_func(cstring, length, errors);
@@ -26837,7 +37294,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     {
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
-            if (strchr(__Pyx_MODULE_NAME, '.')) {
+            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                 module = PyImport_ImportModuleLevelObject(
                     name, global_dict, empty_dict, list, 1);
                 if (!module) {
@@ -27209,6 +37666,28 @@ bad:
     return -1;
 }
 
+/* PyObjectGetAttrStrNoError */
+static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
+    __Pyx_PyThreadState_declare
+    __Pyx_PyThreadState_assign
+    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
+        __Pyx_PyErr_Clear();
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
+        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
+    }
+#endif
+    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
+    if (unlikely(!result)) {
+        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
+    }
+    return result;
+}
+
 /* SetupReduce */
 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
   int ret;
@@ -27254,15 +37733,23 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
 #endif
         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
-            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD;
-            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
-            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
+            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
+            if (likely(reduce_cython)) {
+                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
+                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
+            } else if (reduce == object_reduce || PyErr_Occurred()) {
+                goto __PYX_BAD;
+            }
             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
             if (!setstate) PyErr_Clear();
             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
-                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD;
-                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
-                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
+                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
+                if (likely(setstate_cython)) {
+                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
+                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
+                } else if (!setstate || PyErr_Occurred()) {
+                    goto __PYX_BAD;
+                }
             }
             PyType_Modified((PyTypeObject*)type_obj);
         }
@@ -27324,7 +37811,7 @@ bad:
     goto done;
 }
 
-/* CythonFunction */
+/* CythonFunctionShared */
 #include <structmember.h>
 static PyObject *
 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
@@ -27617,7 +38104,8 @@ static PyObject *
 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
 {
 #if PY_MAJOR_VERSION >= 3
-    return PyUnicode_FromString(m->func.m_ml->ml_name);
+    Py_INCREF(m->func_qualname);
+    return m->func_qualname;
 #else
     return PyString_FromString(m->func.m_ml->ml_name);
 #endif
@@ -27631,10 +38119,9 @@ static PyMethodDef __pyx_CyFunction_methods[] = {
 #else
 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
 #endif
-static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
-                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
-    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
-    if (op == NULL)
+static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
+                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
+    if (unlikely(op == NULL))
         return NULL;
     op->flags = flags;
     __Pyx_CyFunction_weakreflist(op) = NULL;
@@ -27655,12 +38142,12 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f
     Py_XINCREF(code);
     op->func_code = code;
     op->defaults_pyobjects = 0;
+    op->defaults_size = 0;
     op->defaults = NULL;
     op->defaults_tuple = NULL;
     op->defaults_kwdict = NULL;
     op->defaults_getter = NULL;
     op->func_annotations = NULL;
-    PyObject_GC_Track(op);
     return (PyObject *) op;
 }
 static int
@@ -27723,6 +38210,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
 }
 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
 {
+#if PY_MAJOR_VERSION < 3
     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
         Py_INCREF(func);
@@ -27735,6 +38223,7 @@ static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObj
     }
     if (obj == Py_None)
         obj = NULL;
+#endif
     return __Pyx_PyMethod_New(func, obj, type);
 }
 static PyObject*
@@ -27908,6 +38397,7 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t
         return PyErr_NoMemory();
     memset(m->defaults, 0, size);
     m->defaults_pyobjects = pyobjects;
+    m->defaults_size = size;
     return m->defaults;
 }
 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
@@ -27928,20 +38418,23 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py
 
 /* FusedFunction */
 static PyObject *
-__pyx_FusedFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
-                        PyObject *qualname, PyObject *self,
+__pyx_FusedFunction_New(PyMethodDef *ml, int flags,
+                        PyObject *qualname, PyObject *closure,
                         PyObject *module, PyObject *globals,
                         PyObject *code)
 {
-    __pyx_FusedFunctionObject *fusedfunc =
-        (__pyx_FusedFunctionObject *) __Pyx_CyFunction_New(type, ml, flags, qualname,
-                                                           self, module, globals, code);
-    if (!fusedfunc)
-        return NULL;
-    fusedfunc->__signatures__ = NULL;
-    fusedfunc->type = NULL;
-    fusedfunc->self = NULL;
-    return (PyObject *) fusedfunc;
+    PyObject *op = __Pyx_CyFunction_Init(
+        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_FusedFunctionType),
+        ml, flags, qualname, closure, module, globals, code
+    );
+    if (likely(op)) {
+        __pyx_FusedFunctionObject *fusedfunc = (__pyx_FusedFunctionObject *) op;
+        fusedfunc->__signatures__ = NULL;
+        fusedfunc->type = NULL;
+        fusedfunc->self = NULL;
+        PyObject_GC_Track(op);
+    }
+    return op;
 }
 static void
 __pyx_FusedFunction_dealloc(__pyx_FusedFunctionObject *self)
@@ -27981,7 +38474,7 @@ __pyx_FusedFunction_descr_get(PyObject *self, PyObject *obj, PyObject *type)
     }
     if (obj == Py_None)
         obj = NULL;
-    meth = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_NewEx(
+    meth = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_New(
                     ((PyCFunctionObject *) func)->m_ml,
                     ((__pyx_CyFunctionObject *) func)->flags,
                     ((__pyx_CyFunctionObject *) func)->func_qualname,
@@ -27991,6 +38484,20 @@ __pyx_FusedFunction_descr_get(PyObject *self, PyObject *obj, PyObject *type)
                     ((__pyx_CyFunctionObject *) func)->func_code);
     if (!meth)
         return NULL;
+    if (func->func.defaults) {
+        PyObject **pydefaults;
+        int i;
+        if (!__Pyx_CyFunction_InitDefaults((PyObject*)meth,
+                                      func->func.defaults_size,
+                                      func->func.defaults_pyobjects)) {
+            Py_XDECREF((PyObject*)meth);
+            return NULL;
+        }
+        memcpy(meth->func.defaults, func->func.defaults, func->func.defaults_size);
+        pydefaults = __Pyx_CyFunction_Defaults(PyObject *, meth);
+        for (i = 0; i < meth->func.defaults_pyobjects; i++)
+            Py_XINCREF(pydefaults[i]);
+    }
     Py_XINCREF(func->func.func_classobj);
     meth->func.func_classobj = func->func.func_classobj;
     Py_XINCREF(func->__signatures__);
@@ -28026,27 +38533,29 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx)
     if (PyTuple_Check(idx)) {
         PyObject *list = PyList_New(0);
         Py_ssize_t n = PyTuple_GET_SIZE(idx);
-        PyObject *string = NULL;
         PyObject *sep = NULL;
         int i;
-        if (!list)
+        if (unlikely(!list))
             return NULL;
         for (i = 0; i < n; i++) {
+            int ret;
+            PyObject *string;
 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
             PyObject *item = PyTuple_GET_ITEM(idx, i);
 #else
-            PyObject *item = PySequence_ITEM(idx, i);
+            PyObject *item = PySequence_ITEM(idx, i);  if (unlikely(!item)) goto __pyx_err;
 #endif
             string = _obj_to_str(item);
 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
             Py_DECREF(item);
 #endif
-            if (!string || PyList_Append(list, string) < 0)
-                goto __pyx_err;
+            if (unlikely(!string)) goto __pyx_err;
+            ret = PyList_Append(list, string);
             Py_DECREF(string);
+            if (unlikely(ret < 0)) goto __pyx_err;
         }
         sep = PyUnicode_FromString("|");
-        if (sep)
+        if (likely(sep))
             signature = PyUnicode_Join(sep, list);
 __pyx_err:
 ;
@@ -28136,7 +38645,7 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
             PyErr_Format(PyExc_TypeError,
                          "First argument should be of type %.200s, got %.200s.",
                          ((PyTypeObject *) binding_func->type)->tp_name,
-                         self->ob_type->tp_name);
+                         Py_TYPE(self)->tp_name);
             goto bad;
         } else if (unlikely(is_instance == -1)) {
             goto bad;
@@ -28255,6 +38764,7 @@ static PyTypeObject __pyx_FusedFunctionType_type = {
 #endif
 };
 static int __pyx_FusedFunction_init(void) {
+    __pyx_FusedFunctionType_type.tp_base = __pyx_CyFunctionType;
     __pyx_FusedFunctionType = __Pyx_FetchCommonType(&__pyx_FusedFunctionType_type);
     if (__pyx_FusedFunctionType == NULL) {
         return -1;
@@ -28264,7 +38774,7 @@ static int __pyx_FusedFunction_init(void) {
 
 /* CLineInTraceback */
 #ifndef CYTHON_CLINE_IN_TRACEBACK
-static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
+static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
     PyObject *use_cline;
     PyObject *ptype, *pvalue, *ptraceback;
 #if CYTHON_COMPILING_IN_CPYTHON
@@ -28368,7 +38878,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
         int new_max = __pyx_code_cache.max_count + 64;
         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
-            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
         if (unlikely(!entries)) {
             return;
         }
@@ -28900,9 +39410,7 @@ static PyObject *
 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
 {
     const char *ts = *tsp;
-    int i = 0, number;
-    int ndim = ctx->head->field->type->ndim;
-;
+    int i = 0, number, ndim;
     ++ts;
     if (ctx->new_count != 1) {
         PyErr_SetString(PyExc_ValueError,
@@ -28910,6 +39418,7 @@ __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
         return NULL;
     }
     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+    ndim = ctx->head->field->type->ndim;
     while (*ts && *ts != ')') {
         switch (*ts) {
             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
@@ -29039,8 +39548,8 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha
       case 'l': case 'L': case 'q': case 'Q':
       case 'f': case 'd': case 'g':
       case 'O': case 'p':
-        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
-            ctx->enc_packmode == ctx->new_packmode) {
+        if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
+            (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
           ctx->enc_count += ctx->new_count;
           ctx->new_count = 1;
           got_Z = 0;
@@ -29126,13 +39635,13 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
     if (buf->strides) {
         if (spec & __Pyx_MEMVIEW_CONTIG) {
             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                if (buf->strides[dim] != sizeof(void *)) {
+                if (unlikely(buf->strides[dim] != sizeof(void *))) {
                     PyErr_Format(PyExc_ValueError,
                                  "Buffer is not indirectly contiguous "
                                  "in dimension %d.", dim);
                     goto fail;
                 }
-            } else if (buf->strides[dim] != buf->itemsize) {
+            } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
                 PyErr_SetString(PyExc_ValueError,
                                 "Buffer and memoryview are not contiguous "
                                 "in the same dimension.");
@@ -29143,7 +39652,7 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
             Py_ssize_t stride = buf->strides[dim];
             if (stride < 0)
                 stride = -stride;
-            if (stride < buf->itemsize) {
+            if (unlikely(stride < buf->itemsize)) {
                 PyErr_SetString(PyExc_ValueError,
                                 "Buffer and memoryview are not contiguous "
                                 "in the same dimension.");
@@ -29151,17 +39660,17 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
             }
         }
     } else {
-        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+        if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
             PyErr_Format(PyExc_ValueError,
                          "C-contiguous buffer is not contiguous in "
                          "dimension %d", dim);
             goto fail;
-        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+        } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
             PyErr_Format(PyExc_ValueError,
                          "C-contiguous buffer is not indirect in "
                          "dimension %d", dim);
             goto fail;
-        } else if (buf->suboffsets) {
+        } else if (unlikely(buf->suboffsets)) {
             PyErr_SetString(PyExc_ValueError,
                             "Buffer exposes suboffsets but no strides");
             goto fail;
@@ -29175,7 +39684,7 @@ static int
 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
 {
     if (spec & __Pyx_MEMVIEW_DIRECT) {
-        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+        if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
             PyErr_Format(PyExc_ValueError,
                          "Buffer not compatible with direct access "
                          "in dimension %d.", dim);
@@ -29183,7 +39692,7 @@ __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec
         }
     }
     if (spec & __Pyx_MEMVIEW_PTR) {
-        if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
+        if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
             PyErr_Format(PyExc_ValueError,
                          "Buffer is not indirectly accessible "
                          "in dimension %d.", dim);
@@ -29201,9 +39710,7 @@ __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
         Py_ssize_t stride = 1;
         for (i = 0; i < ndim; i++) {
-            if (stride * buf->itemsize != buf->strides[i] &&
-                    buf->shape[i] > 1)
-            {
+            if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                 PyErr_SetString(PyExc_ValueError,
                     "Buffer not fortran contiguous.");
                 goto fail;
@@ -29213,8 +39720,7 @@ __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
         Py_ssize_t stride = 1;
         for (i = ndim - 1; i >- 1; i--) {
-            if (stride * buf->itemsize != buf->strides[i] &&
-                    buf->shape[i] > 1) {
+            if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                 PyErr_SetString(PyExc_ValueError,
                     "Buffer not C contiguous.");
                 goto fail;
@@ -29255,7 +39761,7 @@ static int __Pyx_ValidateAndInit_memviewslice(
             goto fail;
     }
     buf = &memview->view;
-    if (buf->ndim != ndim) {
+    if (unlikely(buf->ndim != ndim)) {
         PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 ndim, buf->ndim);
@@ -29263,9 +39769,9 @@ static int __Pyx_ValidateAndInit_memviewslice(
     }
     if (new_memview) {
         __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+        if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
     }
-    if ((unsigned) buf->itemsize != dtype->size) {
+    if (unlikely((unsigned) buf->itemsize != dtype->size)) {
         PyErr_Format(PyExc_ValueError,
                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
@@ -29276,15 +39782,17 @@ static int __Pyx_ValidateAndInit_memviewslice(
                      (dtype->size > 1) ? "s" : "");
         goto fail;
     }
-    for (i = 0; i < ndim; i++) {
-        spec = axes_specs[i];
-        if (!__pyx_check_strides(buf, i, ndim, spec))
-            goto fail;
-        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+    if (buf->len > 0) {
+        for (i = 0; i < ndim; i++) {
+            spec = axes_specs[i];
+            if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
+                goto fail;
+            if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
+                goto fail;
+        }
+        if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
             goto fail;
     }
-    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
-        goto fail;
     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
                                          new_memview != NULL) == -1)) {
         goto fail;
@@ -29369,7 +39877,7 @@ __pyx_fail:
 }
 
 /* ObjectToMemviewSlice */
-  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_PY_LONG_LONG(PyObject *obj, int writable_flag) {
+  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *obj, int writable_flag) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
@@ -29380,7 +39888,7 @@ __pyx_fail:
     }
     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                  (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
-                                                 &__Pyx_TypeInfo_PY_LONG_LONG, stack,
+                                                 &__Pyx_TypeInfo_float, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -29392,7 +39900,7 @@ __pyx_fail:
 }
 
 /* ObjectToMemviewSlice */
-  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *obj, int writable_flag) {
+  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *obj, int writable_flag) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
@@ -29403,7 +39911,30 @@ __pyx_fail:
     }
     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                  (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
-                                                 &__Pyx_TypeInfo_float, stack,
+                                                 &__Pyx_TypeInfo_double, stack,
+                                                 &result, obj);
+    if (unlikely(retcode == -1))
+        goto __pyx_fail;
+    return result;
+__pyx_fail:
+    result.memview = NULL;
+    result.data = NULL;
+    return result;
+}
+
+/* ObjectToMemviewSlice */
+  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__short(PyObject *obj, int writable_flag) {
+    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
+    __Pyx_BufFmt_StackElem stack[1];
+    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
+    int retcode;
+    if (obj == Py_None) {
+        result.memview = (struct __pyx_memoryview_obj *) Py_None;
+        return result;
+    }
+    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
+                                                 (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
+                                                 &__Pyx_TypeInfo_short, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -29415,18 +39946,18 @@ __pyx_fail:
 }
 
 /* ObjectToMemviewSlice */
-  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *obj, int writable_flag) {
+  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__int(PyObject *obj, int writable_flag) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
-    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
+    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
     int retcode;
     if (obj == Py_None) {
         result.memview = (struct __pyx_memoryview_obj *) Py_None;
         return result;
     }
-    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
-                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
-                                                 &__Pyx_TypeInfo_double, stack,
+    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
+                                                 (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
+                                                 &__Pyx_TypeInfo_int, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -29438,7 +39969,7 @@ __pyx_fail:
 }
 
 /* ObjectToMemviewSlice */
-  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__short(PyObject *obj, int writable_flag) {
+  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__long(PyObject *obj, int writable_flag) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
@@ -29449,7 +39980,7 @@ __pyx_fail:
     }
     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
                                                  (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
-                                                 &__Pyx_TypeInfo_short, stack,
+                                                 &__Pyx_TypeInfo_long, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -29461,18 +39992,18 @@ __pyx_fail:
 }
 
 /* ObjectToMemviewSlice */
-  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__int(PyObject *obj, int writable_flag) {
+  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_short(PyObject *obj, int writable_flag) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
-    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
+    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
     int retcode;
     if (obj == Py_None) {
         result.memview = (struct __pyx_memoryview_obj *) Py_None;
         return result;
     }
-    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
-                                                 (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
-                                                 &__Pyx_TypeInfo_int, stack,
+    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
+                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
+                                                 &__Pyx_TypeInfo_short, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -29484,18 +40015,18 @@ __pyx_fail:
 }
 
 /* ObjectToMemviewSlice */
-  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__long(PyObject *obj, int writable_flag) {
+  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int(PyObject *obj, int writable_flag) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
-    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
+    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
     int retcode;
     if (obj == Py_None) {
         result.memview = (struct __pyx_memoryview_obj *) Py_None;
         return result;
     }
-    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
-                                                 (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
-                                                 &__Pyx_TypeInfo_long, stack,
+    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
+                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
+                                                 &__Pyx_TypeInfo_int, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -29507,18 +40038,18 @@ __pyx_fail:
 }
 
 /* ObjectToMemviewSlice */
-  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__PY_LONG_LONG(PyObject *obj, int writable_flag) {
+  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_long(PyObject *obj, int writable_flag) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
-    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
+    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
     int retcode;
     if (obj == Py_None) {
         result.memview = (struct __pyx_memoryview_obj *) Py_None;
         return result;
     }
-    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
-                                                 (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
-                                                 &__Pyx_TypeInfo_PY_LONG_LONG, stack,
+    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
+                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
+                                                 &__Pyx_TypeInfo_long, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -29529,66 +40060,62 @@ __pyx_fail:
     return result;
 }
 
-/* CIntToPy */
-  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
-    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
-    const int is_unsigned = neg_one > const_zero;
-    if (is_unsigned) {
-        if (sizeof(long) < sizeof(long)) {
-            return PyInt_FromLong((long) value);
-        } else if (sizeof(long) <= sizeof(unsigned long)) {
-            return PyLong_FromUnsignedLong((unsigned long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
-            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
-#endif
-        }
-    } else {
-        if (sizeof(long) <= sizeof(long)) {
-            return PyInt_FromLong((long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
-            return PyLong_FromLongLong((PY_LONG_LONG) value);
-#endif
-        }
-    }
-    {
-        int one = 1; int little = (int)*(unsigned char *)&one;
-        unsigned char *bytes = (unsigned char *)&value;
-        return _PyLong_FromByteArray(bytes, sizeof(long),
-                                     little, !is_unsigned);
+/* CIntFromPyVerify */
+  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
+    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
+#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
+    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
+#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
+    {\
+        func_type value = func_value;\
+        if (sizeof(target_type) < sizeof(func_type)) {\
+            if (unlikely(value != (func_type) (target_type) value)) {\
+                func_type zero = 0;\
+                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
+                    return (target_type) -1;\
+                if (is_unsigned && unlikely(value < zero))\
+                    goto raise_neg_overflow;\
+                else\
+                    goto raise_overflow;\
+            }\
+        }\
+        return (target_type) value;\
     }
+
+/* MemviewDtypeToObject */
+  static CYTHON_INLINE PyObject *__pyx_memview_get_long(const char *itemp) {
+    return (PyObject *) __Pyx_PyInt_From_long(*(long *) itemp);
+}
+static CYTHON_INLINE int __pyx_memview_set_long(const char *itemp, PyObject *obj) {
+    long value = __Pyx_PyInt_As_long(obj);
+    if ((value == (long)-1) && PyErr_Occurred())
+        return 0;
+    *(long *) itemp = value;
+    return 1;
 }
 
-/* CIntToPy */
-  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
-    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
-    const int is_unsigned = neg_one > const_zero;
-    if (is_unsigned) {
-        if (sizeof(int) < sizeof(long)) {
-            return PyInt_FromLong((long) value);
-        } else if (sizeof(int) <= sizeof(unsigned long)) {
-            return PyLong_FromUnsignedLong((unsigned long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
-            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
-#endif
-        }
-    } else {
-        if (sizeof(int) <= sizeof(long)) {
-            return PyInt_FromLong((long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
-            return PyLong_FromLongLong((PY_LONG_LONG) value);
-#endif
-        }
-    }
-    {
-        int one = 1; int little = (int)*(unsigned char *)&one;
-        unsigned char *bytes = (unsigned char *)&value;
-        return _PyLong_FromByteArray(bytes, sizeof(int),
-                                     little, !is_unsigned);
-    }
+/* MemviewDtypeToObject */
+  static CYTHON_INLINE PyObject *__pyx_memview_get_short(const char *itemp) {
+    return (PyObject *) __Pyx_PyInt_From_short(*(short *) itemp);
+}
+static CYTHON_INLINE int __pyx_memview_set_short(const char *itemp, PyObject *obj) {
+    short value = __Pyx_PyInt_As_short(obj);
+    if ((value == (short)-1) && PyErr_Occurred())
+        return 0;
+    *(short *) itemp = value;
+    return 1;
+}
+
+/* MemviewDtypeToObject */
+  static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp) {
+    return (PyObject *) __Pyx_PyInt_From_int(*(int *) itemp);
+}
+static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) {
+    int value = __Pyx_PyInt_As_int(obj);
+    if ((value == (int)-1) && PyErr_Occurred())
+        return 0;
+    *(int *) itemp = value;
+    return 1;
 }
 
 /* MemviewSliceCopyTemplate */
@@ -29609,113 +40136,261 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     struct __pyx_memoryview_obj *memview_obj = NULL;
     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
     for (i = 0; i < ndim; i++) {
-        if (from_mvs->suboffsets[i] >= 0) {
+        if (unlikely(from_mvs->suboffsets[i] >= 0)) {
             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
                                            "indirect dimensions (axis %d)", i);
             goto fail;
         }
-    }
-    shape_tuple = PyTuple_New(ndim);
-    if (unlikely(!shape_tuple)) {
-        goto fail;
-    }
-    __Pyx_GOTREF(shape_tuple);
-    for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
-        if(unlikely(!temp_int)) {
-            goto fail;
-        } else {
-            PyTuple_SET_ITEM(shape_tuple, i, temp_int);
-            temp_int = NULL;
+    }
+    shape_tuple = PyTuple_New(ndim);
+    if (unlikely(!shape_tuple)) {
+        goto fail;
+    }
+    __Pyx_GOTREF(shape_tuple);
+    for(i = 0; i < ndim; i++) {
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
+        if(unlikely(!temp_int)) {
+            goto fail;
+        } else {
+            PyTuple_SET_ITEM(shape_tuple, i, temp_int);
+            temp_int = NULL;
+        }
+    }
+    array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
+    if (unlikely(!array_obj)) {
+        goto fail;
+    }
+    __Pyx_GOTREF(array_obj);
+    memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                    (PyObject *) array_obj, contig_flag,
+                                    dtype_is_object,
+                                    from_mvs->memview->typeinfo);
+    if (unlikely(!memview_obj))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
+        goto fail;
+    if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
+                                                dtype_is_object) < 0))
+        goto fail;
+    goto no_fail;
+fail:
+    __Pyx_XDECREF(new_mvs.memview);
+    new_mvs.memview = NULL;
+    new_mvs.data = NULL;
+no_fail:
+    __Pyx_XDECREF(shape_tuple);
+    __Pyx_XDECREF(temp_int);
+    __Pyx_XDECREF(array_obj);
+    __Pyx_RefNannyFinishContext();
+    return new_mvs;
+}
+
+/* CIntFromPy */
+  static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) {
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+    const short neg_one = (short) -1, const_zero = (short) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
+    const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+    if (likely(PyInt_Check(x))) {
+        if (sizeof(short) < sizeof(long)) {
+            __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x))
+        } else {
+            long val = PyInt_AS_LONG(x);
+            if (is_unsigned && unlikely(val < 0)) {
+                goto raise_neg_overflow;
+            }
+            return (short) val;
+        }
+    } else
+#endif
+    if (likely(PyLong_Check(x))) {
+        if (is_unsigned) {
+#if CYTHON_USE_PYLONG_INTERNALS
+            const digit* digits = ((PyLongObject*)x)->ob_digit;
+            switch (Py_SIZE(x)) {
+                case  0: return (short) 0;
+                case  1: __PYX_VERIFY_RETURN_INT(short, digit, digits[0])
+                case 2:
+                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) >= 2 * PyLong_SHIFT) {
+                            return (short) (((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
+                        }
+                    }
+                    break;
+                case 3:
+                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) >= 3 * PyLong_SHIFT) {
+                            return (short) (((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
+                        }
+                    }
+                    break;
+                case 4:
+                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) >= 4 * PyLong_SHIFT) {
+                            return (short) (((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
+                        }
+                    }
+                    break;
+            }
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+            if (unlikely(Py_SIZE(x) < 0)) {
+                goto raise_neg_overflow;
+            }
+#else
+            {
+                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
+                if (unlikely(result < 0))
+                    return (short) -1;
+                if (unlikely(result == 1))
+                    goto raise_neg_overflow;
+            }
+#endif
+            if (sizeof(short) <= sizeof(unsigned long)) {
+                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned long, PyLong_AsUnsignedLong(x))
+#ifdef HAVE_LONG_LONG
+            } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
+                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
+#endif
+            }
+        } else {
+#if CYTHON_USE_PYLONG_INTERNALS
+            const digit* digits = ((PyLongObject*)x)->ob_digit;
+            switch (Py_SIZE(x)) {
+                case  0: return (short) 0;
+                case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, (sdigit) (-(sdigit)digits[0]))
+                case  1: __PYX_VERIFY_RETURN_INT(short,  digit, +digits[0])
+                case -2:
+                    if (8 * sizeof(short) - 1 > 1 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
+                            return (short) (((short)-1)*(((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
+                        }
+                    }
+                    break;
+                case 2:
+                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
+                            return (short) ((((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
+                        }
+                    }
+                    break;
+                case -3:
+                    if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
+                            return (short) (((short)-1)*(((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
+                        }
+                    }
+                    break;
+                case 3:
+                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
+                            return (short) ((((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
+                        }
+                    }
+                    break;
+                case -4:
+                    if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
+                            return (short) (((short)-1)*(((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
+                        }
+                    }
+                    break;
+                case 4:
+                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
+                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
+                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
+                        } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
+                            return (short) ((((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
+                        }
+                    }
+                    break;
+            }
+#endif
+            if (sizeof(short) <= sizeof(long)) {
+                __PYX_VERIFY_RETURN_INT_EXC(short, long, PyLong_AsLong(x))
+#ifdef HAVE_LONG_LONG
+            } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
+                __PYX_VERIFY_RETURN_INT_EXC(short, PY_LONG_LONG, PyLong_AsLongLong(x))
+#endif
+            }
+        }
+        {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+            PyErr_SetString(PyExc_RuntimeError,
+                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+            short val;
+            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
+ #if PY_MAJOR_VERSION < 3
+            if (likely(v) && !PyLong_Check(v)) {
+                PyObject *tmp = v;
+                v = PyNumber_Long(tmp);
+                Py_DECREF(tmp);
+            }
+ #endif
+            if (likely(v)) {
+                int one = 1; int is_little = (int)*(unsigned char *)&one;
+                unsigned char *bytes = (unsigned char *)&val;
+                int ret = _PyLong_AsByteArray((PyLongObject *)v,
+                                              bytes, sizeof(val),
+                                              is_little, !is_unsigned);
+                Py_DECREF(v);
+                if (likely(!ret))
+                    return val;
+            }
+#endif
+            return (short) -1;
         }
+    } else {
+        short val;
+        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
+        if (!tmp) return (short) -1;
+        val = __Pyx_PyInt_As_short(tmp);
+        Py_DECREF(tmp);
+        return val;
     }
-    array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
-    if (unlikely(!array_obj)) {
-        goto fail;
-    }
-    __Pyx_GOTREF(array_obj);
-    memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                    (PyObject *) array_obj, contig_flag,
-                                    dtype_is_object,
-                                    from_mvs->memview->typeinfo);
-    if (unlikely(!memview_obj))
-        goto fail;
-    if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
-        goto fail;
-    if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
-                                                dtype_is_object) < 0))
-        goto fail;
-    goto no_fail;
-fail:
-    __Pyx_XDECREF(new_mvs.memview);
-    new_mvs.memview = NULL;
-    new_mvs.data = NULL;
-no_fail:
-    __Pyx_XDECREF(shape_tuple);
-    __Pyx_XDECREF(temp_int);
-    __Pyx_XDECREF(array_obj);
-    __Pyx_RefNannyFinishContext();
-    return new_mvs;
-}
-
-/* BytesContains */
-  static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character) {
-    const Py_ssize_t length = PyBytes_GET_SIZE(bytes);
-    char* char_start = PyBytes_AS_STRING(bytes);
-    return memchr(char_start, (unsigned char)character, (size_t)length) != NULL;
-}
-
-/* ImportNumPyArray */
-  static PyObject* __Pyx__ImportNumPyArray(void) {
-    PyObject *numpy_module, *ndarray_object = NULL;
-    numpy_module = __Pyx_Import(__pyx_n_s_numpy, NULL, 0);
-    if (likely(numpy_module)) {
-        ndarray_object = PyObject_GetAttrString(numpy_module, "ndarray");
-        Py_DECREF(numpy_module);
-    }
-    if (unlikely(!ndarray_object)) {
-        PyErr_Clear();
-    }
-    if (unlikely(!ndarray_object || !PyObject_TypeCheck(ndarray_object, &PyType_Type))) {
-        Py_XDECREF(ndarray_object);
-        Py_INCREF(Py_None);
-        ndarray_object = Py_None;
-    }
-    return ndarray_object;
-}
-static CYTHON_INLINE PyObject* __Pyx_ImportNumPyArrayTypeIfAvailable(void) {
-    if (unlikely(!__pyx_numpy_ndarray)) {
-        __pyx_numpy_ndarray = __Pyx__ImportNumPyArray();
-    }
-    Py_INCREF(__pyx_numpy_ndarray);
-    return __pyx_numpy_ndarray;
+raise_overflow:
+    PyErr_SetString(PyExc_OverflowError,
+        "value too large to convert to short");
+    return (short) -1;
+raise_neg_overflow:
+    PyErr_SetString(PyExc_OverflowError,
+        "can't convert negative value to short");
+    return (short) -1;
 }
 
-/* CIntFromPyVerify */
-  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
-    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
-#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
-    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
-#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
-    {\
-        func_type value = func_value;\
-        if (sizeof(target_type) < sizeof(func_type)) {\
-            if (unlikely(value != (func_type) (target_type) value)) {\
-                func_type zero = 0;\
-                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
-                    return (target_type) -1;\
-                if (is_unsigned && unlikely(value < zero))\
-                    goto raise_neg_overflow;\
-                else\
-                    goto raise_overflow;\
-            }\
-        }\
-        return (target_type) value;\
-    }
-
 /* CIntFromPy */
   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
-    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+    const int neg_one = (int) -1, const_zero = (int) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
     const int is_unsigned = neg_one > const_zero;
 #if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
@@ -29904,7 +40579,14 @@ raise_neg_overflow:
 
 /* CIntFromPy */
   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
-    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+    const long neg_one = (long) -1, const_zero = (long) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
     const int is_unsigned = neg_one > const_zero;
 #if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
@@ -30091,9 +40773,163 @@ raise_neg_overflow:
     return (long) -1;
 }
 
+/* CIntToPy */
+  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+    const long neg_one = (long) -1, const_zero = (long) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
+    const int is_unsigned = neg_one > const_zero;
+    if (is_unsigned) {
+        if (sizeof(long) < sizeof(long)) {
+            return PyInt_FromLong((long) value);
+        } else if (sizeof(long) <= sizeof(unsigned long)) {
+            return PyLong_FromUnsignedLong((unsigned long) value);
+#ifdef HAVE_LONG_LONG
+        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
+            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
+#endif
+        }
+    } else {
+        if (sizeof(long) <= sizeof(long)) {
+            return PyInt_FromLong((long) value);
+#ifdef HAVE_LONG_LONG
+        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
+            return PyLong_FromLongLong((PY_LONG_LONG) value);
+#endif
+        }
+    }
+    {
+        int one = 1; int little = (int)*(unsigned char *)&one;
+        unsigned char *bytes = (unsigned char *)&value;
+        return _PyLong_FromByteArray(bytes, sizeof(long),
+                                     little, !is_unsigned);
+    }
+}
+
+/* CIntToPy */
+  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+    const int neg_one = (int) -1, const_zero = (int) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
+    const int is_unsigned = neg_one > const_zero;
+    if (is_unsigned) {
+        if (sizeof(int) < sizeof(long)) {
+            return PyInt_FromLong((long) value);
+        } else if (sizeof(int) <= sizeof(unsigned long)) {
+            return PyLong_FromUnsignedLong((unsigned long) value);
+#ifdef HAVE_LONG_LONG
+        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
+            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
+#endif
+        }
+    } else {
+        if (sizeof(int) <= sizeof(long)) {
+            return PyInt_FromLong((long) value);
+#ifdef HAVE_LONG_LONG
+        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
+            return PyLong_FromLongLong((PY_LONG_LONG) value);
+#endif
+        }
+    }
+    {
+        int one = 1; int little = (int)*(unsigned char *)&one;
+        unsigned char *bytes = (unsigned char *)&value;
+        return _PyLong_FromByteArray(bytes, sizeof(int),
+                                     little, !is_unsigned);
+    }
+}
+
+/* CIntToPy */
+  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+    const short neg_one = (short) -1, const_zero = (short) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
+    const int is_unsigned = neg_one > const_zero;
+    if (is_unsigned) {
+        if (sizeof(short) < sizeof(long)) {
+            return PyInt_FromLong((long) value);
+        } else if (sizeof(short) <= sizeof(unsigned long)) {
+            return PyLong_FromUnsignedLong((unsigned long) value);
+#ifdef HAVE_LONG_LONG
+        } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
+            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
+#endif
+        }
+    } else {
+        if (sizeof(short) <= sizeof(long)) {
+            return PyInt_FromLong((long) value);
+#ifdef HAVE_LONG_LONG
+        } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
+            return PyLong_FromLongLong((PY_LONG_LONG) value);
+#endif
+        }
+    }
+    {
+        int one = 1; int little = (int)*(unsigned char *)&one;
+        unsigned char *bytes = (unsigned char *)&value;
+        return _PyLong_FromByteArray(bytes, sizeof(short),
+                                     little, !is_unsigned);
+    }
+}
+
+/* BytesContains */
+  static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character) {
+    const Py_ssize_t length = PyBytes_GET_SIZE(bytes);
+    char* char_start = PyBytes_AS_STRING(bytes);
+    return memchr(char_start, (unsigned char)character, (size_t)length) != NULL;
+}
+
+/* ImportNumPyArray */
+  static PyObject* __Pyx__ImportNumPyArray(void) {
+    PyObject *numpy_module, *ndarray_object = NULL;
+    numpy_module = __Pyx_Import(__pyx_n_s_numpy, NULL, 0);
+    if (likely(numpy_module)) {
+        ndarray_object = PyObject_GetAttrString(numpy_module, "ndarray");
+        Py_DECREF(numpy_module);
+    }
+    if (unlikely(!ndarray_object)) {
+        PyErr_Clear();
+    }
+    if (unlikely(!ndarray_object || !PyObject_TypeCheck(ndarray_object, &PyType_Type))) {
+        Py_XDECREF(ndarray_object);
+        Py_INCREF(Py_None);
+        ndarray_object = Py_None;
+    }
+    return ndarray_object;
+}
+static CYTHON_INLINE PyObject* __Pyx_ImportNumPyArrayTypeIfAvailable(void) {
+    if (unlikely(!__pyx_numpy_ndarray)) {
+        __pyx_numpy_ndarray = __Pyx__ImportNumPyArray();
+    }
+    Py_INCREF(__pyx_numpy_ndarray);
+    return __pyx_numpy_ndarray;
+}
+
 /* CIntFromPy */
   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
-    const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+    const char neg_one = (char) -1, const_zero = (char) 0;
+#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
     const int is_unsigned = neg_one > const_zero;
 #if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
diff --git a/c_corr.pyx b/c_corr.pyx
index 0e67e22..bd61720 100755
--- a/c_corr.pyx
+++ b/c_corr.pyx
@@ -7,7 +7,6 @@ ctypedef fused npType1:
     short
     int
     long
-    long long
     float
     double
 
@@ -15,11 +14,11 @@ ctypedef fused npType2:
     short
     int
     long
-    long long
 
 
 @cython.boundscheck(False)
 @cython.wraparound(False)
+@cython.embedsignature(True)
 def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
     total = taus.shape[1]
     n_pair = taus.shape[0]
@@ -38,34 +37,48 @@ def c_corr_at(npType1[:,::1] cc, npType2[::1, :] taus):
 
 @cython.boundscheck(False)
 @cython.wraparound(False)
-def c_corr_all(npType1[:,::1] cc, npType2 max_tdoa, npType2 base_tdoa):
+@cython.embedsignature(True)
+cpdef c_corr_all(cc, npType2 max_tdoa, npType2 base_tdoa):
+    cdef float[:,::1] cc_mem = cc.astype(np.float32)
     cdef double corr_val = 0.0
-    taus = np.zeros(cc.shape[0], int)
-    out_taus = np.zeros(cc.shape[0], int)
-    _c_corr_core(cc, taus, out_taus,  corr_val, base_tdoa-1, base_tdoa, max_tdoa, cc.shape[1], cc.shape[0])
+    cdef long[::1] taus = np.zeros(cc.shape[0], int)
+    cdef long[::1] out_taus = np.zeros(cc.shape[0], int)
+    corr_val = _c_corr_core(cc_mem, taus, out_taus,  corr_val, <long> base_tdoa-1, <long> base_tdoa,
+                            <long> max_tdoa, <long> cc.shape[1], <long> cc.shape[0])
     return np.log10(corr_val), out_taus
 
 
+cdef long moduloNeg(long a, long b):
+    if a < 0:
+        return a + b
+    else:
+        return a
+
+
 @cython.boundscheck(False)
 @cython.wraparound(False)
-def _c_corr_core(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
-                 npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+@cython.profile(True)
+cdef double _c_corr_core(float[:,::1] cc, long[::1] taus, long[::1] out_taus, double val,
+                 long curr_tdoa, long ind_tdoa, long max_tdoa, long win_size, long n_pair):
+    cdef int i0 = 1
+    cdef int j0 = 0
+    cdef double tmp_val = 0.0
     if curr_tdoa < 0:
-        cdef int i0 = 1
-        cdef int j0 = 0
         for i in range(ind_tdoa, n_pair):
             taus[i] = taus[i0] - taus[j0]
             i0 += 1
             if i0 >= ind_tdoa:
                 j0 += 1
                 i0 = j0 + 1
-        val = cc[0, taus[0]]
+        tmp_val = cc[0, moduloNeg(taus[0], win_size)]
         for i in range(1, n_pair):
-            val *= cc[i, taus[i] % win_size]
+            tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+        if val < tmp_val:
+            val = tmp_val
+            out_taus[:] = taus
         return val
     cdef int low = -max_tdoa
     cdef int high = max_tdoa
-    cdef double tmp_val = 0
     for i in range(curr_tdoa+1, ind_tdoa):
         if low < taus[i] - max_tdoa:
             low = -max_tdoa + taus[i]
@@ -73,8 +86,40 @@ def _c_corr_core(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, do
             high = max_tdoa + taus[i]
     for t in range(low, high+1):
         taus[curr_tdoa] = t
-        tmp_val = _c_corr_core(cc, taus, out_taus, val, curr_tdoa-1, ind_tdoa, max_size, win_size, n_pair)
-        if val < tmp_val:
-            val = tmp_val
-            out_taus[:] = taus
+        val = _c_corr_core(cc, taus, out_taus, val, curr_tdoa-1, ind_tdoa, max_tdoa, win_size, n_pair)
+    return val
+
+
+@cython.boundscheck(False)
+@cython.wraparound(False)
+@cython.profile(True)
+def _c_corr_core2(npType1[:,::1] cc, npType2[::1] taus, npType2[::1] out_taus, double val,
+                 npType2 curr_tdoa, npType2 ind_tdoa, npType2 max_tdoa, npType2 win_size, npType2 n_pair):
+    cdef int i0 = 1
+    cdef int j0 = 0
+    cdef double tmp_val = 0.0
+    for i in range(ind_tdoa):
+        taus[i] =  - max_tdoa - 1
+    cdef int level = 0
+    while level >= 0:
+        taus[level] += 1
+        if taus[level] > min(taus[:level]) + max_tdoa:
+            taus[level] = max(taus[:level]) - max_tdoa - 1
+            level -= 1
+            continue
+        level +=1
+        if level == ind_tdoa:
+            level -= 1
+            for i in range(ind_tdoa, n_pair):
+                taus[i] = taus[i0] - taus[j0]
+                i0 += 1
+                if i0 >= ind_tdoa:
+                    j0 += 1
+                    i0 = j0 + 1
+                tmp_val = cc[0, moduloNeg(taus[0], win_size)]
+            for i in range(1, n_pair):
+                tmp_val *= cc[i, moduloNeg(taus[i], win_size)]
+            if val < tmp_val:
+                val = tmp_val
+                out_taus[:] = taus
     return val
\ No newline at end of file
diff --git a/cython_setup.py b/cython_setup.py
index 2b036a1..73f0fe2 100755
--- a/cython_setup.py
+++ b/cython_setup.py
@@ -2,5 +2,5 @@ from distutils.core import setup
 from Cython.Build import cythonize
 
 setup(
-    ext_modules = cythonize("c_corr.pyx", annotate=True)
+    ext_modules = cythonize("c_corr.pyx", annotate=True, compiler_directives={'language_level' : "3"})
 )
\ No newline at end of file
diff --git a/gsrp_smart_util.py b/gsrp_smart_util.py
new file mode 100644
index 0000000..5cd7863
--- /dev/null
+++ b/gsrp_smart_util.py
@@ -0,0 +1,143 @@
+import numpy as np
+from math import ceil
+
+
+class Operation:
+    __slots__ = 'op', 'left', 'right', 'lifetime'
+
+    def __init__(self, op, left, right, lifetime):
+        self.op = op
+        self.left = left
+        self.right = right
+        self.lifetime = lifetime
+        
+    def __repr__(self):
+        return f'(op: {self.op}, l: {self.left}, r: {self.right}, lt: {self.lifetime})'
+        
+    def __eq__(self, other):
+        if isinstance(other, str):
+            return self.op == other
+        elif isinstance(other, Operation):
+            return self.op == other.op and self.left == other.left and\
+                   self.right == other.right and self.lifetime == other.lifetime
+        return False
+
+
+def gen_tree(size):
+    tree = [list() for _ in range(size)]
+    tree[-1].append(list(range(size)))
+    for i in range(size-2, -1, -1):
+        m_len = i + 1
+        unused = []
+        for group in tree[i+1]:
+            if len(group) > m_len:
+                tree[i].append(group[:-1].copy())
+                unused.append(group[-1])
+            else:
+                tree[i].append(group.copy())
+        for group in tree[i]:
+            le = len(group)
+            if le < m_len:
+                group.extend(unused[:m_len-le])
+                unused = unused[m_len-le:]
+            if not len(unused):
+                break
+        if len(unused):
+            for j in range(ceil(len(unused)/m_len)):
+                tree[i].append(unused[j*m_len:(j+1)*m_len])
+    return tree
+
+
+def op_tree(tree):
+    program = [list() for _ in range(len(tree))]
+    clean_list = [list() for _ in range(len(tree) + 1)]
+    program[0] = [Operation('mem', 0, group[0], len(tree)) for group in tree[0]]
+    for i in range(1, len(tree)):
+        for group in tree[i]:
+            if group[:-1] in tree[i-1]:
+                j = tree[i-1].index(group[:-1])
+                program[i-1][j].lifetime = i
+                program[i].append(Operation('mul', j, tree[0].index(group[-1:]), i))
+            else:
+                for j in range(i-1, -1, -1):
+                    if group in tree[j]:
+                        break
+                else:
+                    raise KeyError(f'{group} not found in:\n{tree}')
+                program[i].append(Operation('mem', j, tree[j].index(group), i))
+    for i, step in enumerate(program):
+        for j, op in enumerate(step):
+            clean_list[op.lifetime].append((i, j))
+    return program, clean_list
+
+
+def dep_tdoa(tij, nind, ntot):
+    i0 = 1
+    j0 = 0
+    for i in range(nind, ntot):
+        tij[i] = tij[i0] - tij[j0]
+        i0 += 1
+        if i0 >= nind:
+            j0 += 1
+            i0 = j0 + 1
+
+
+def num_ind(i, j, nind):
+    return j*(nind-1) + i-1 - (j*(j+1))//2
+
+
+def mul(mem1, mem2, cc, t_max, id1, id2, n_ind):
+    # assume len(id2) == 1
+    idx1, idx2 = np.meshgrid(np.arange(len(mem1[0])), np.arange(len(mem2[1])))
+    idx1, idx2 = idx1.ravel(), idx2.ravel()
+    out_tij = np.concatenate((mem1[1][idx1], mem2[1][idx2]), axis=-1)
+    mask = (np.abs(out_tij[:, :-1] - out_tij[:, -1:]) <= t_max).all(-1)
+    out_tij = out_tij[mask]
+    idx1, idx2 = idx1[mask], idx2[mask]
+    out_val = mem1[0][idx1] * mem2[0][idx2]
+    tij_dep = out_tij[:, :-1] - out_tij[:, -1:]
+    tij_dep *= np.array([1 if i > id2 else -1 for i in id1])
+    ch_dep = np.array([num_ind(i, id2, n_ind) if i > id2 else num_ind(id2, i, n_ind) for i in id1]) + n_ind
+    out_val *= cc[tij_dep, ch_dep].prod(-1)
+    return out_val, out_tij
+
+
+def mask_val(mem, val):
+    mask = mem[0] >= val
+    return mem[0][mask], mem[1][mask]
+
+
+def smart_gsrp(cc, n_ind, n_tot, t_max, tree, program, clean_list):
+    memory = dict()
+    val = 0
+    tij = np.zeros(n_tot, int)
+    for i, step in enumerate(program):
+        # increase dimensions
+        for j, op in enumerate(step):
+            if op == 'mem':
+                if i == 0:
+                    memory[(0, j)] = (np.concatenate((cc[-t_max:, op.right], cc[:t_max + 1, op.right])),
+                                      np.arange(-t_max, t_max + 1).reshape(-1, 1))
+                else:
+                    memory[(i, j)] = mask_val(memory[(op.left, op.right)], val)
+            else:  # op == 'mul'
+                memory[(i, j)] = mul(mask_val(memory[(i-1, op.left)], val), mask_val(memory[(0, op.right)], val),
+                                     cc, t_max, tree[i - 1][op.left], tree[0][op.right][0], n_ind)
+        # find potential maximum
+        for j in range(len(step)):
+            tij[tree[i][j]] = memory[(i, j)][1][np.argmax(memory[(i, j)][0])]
+        dep_tdoa(tij, n_ind, n_tot)
+        val = cc[tij, np.arange(n_tot)].prod()
+        # print('tdoa:', tij, 'val:', val, 'mem size:', (lambda x: f'{x} ({100 * x / (2 * t_max + 1) ** i}%)')(sum(len(o[0]) for o in memory.values())))
+
+        # Mem clean up
+        for p in clean_list[i]:
+            del memory[p]
+
+    return val, tij
+
+
+
+
+
+
diff --git a/gsrp_tdoa_hyperres.py b/gsrp_tdoa_hyperres.py
index 73836c1..419a754 100755
--- a/gsrp_tdoa_hyperres.py
+++ b/gsrp_tdoa_hyperres.py
@@ -10,6 +10,8 @@ from numpy.fft import rfft, irfft
 import scipy.signal as sg
 import soundfile as sf
 import c_corr
+from gsrp_smart_util import *
+from math import ceil
 from scipy.signal.windows import tukey
 
 try:
@@ -58,6 +60,7 @@ def corr(data, pos, w_size, max_tdoa, decimate=1, mode='prepare', hyper=True):
         mat[k, j - 1] = 1
         v1[k] = i
         v2[k] = j
+    dw_size = w_size // decimate
     if mode == 'prepare':
         slices = slicer(-(cc_size // 2), cc_size // 2, (num_channels - 1), 16)
         tausf = []
@@ -66,10 +69,12 @@ def corr(data, pos, w_size, max_tdoa, decimate=1, mode='prepare', hyper=True):
             taus2 = np.matmul(mat, taus)
             tausf += [taus2[:, np.abs(taus2).max(0) <= cc_size // 2]]
         tausf = np.hstack(tausf)
-        dw_size = w_size // decimate
         tausf %= dw_size
     elif mode == 'on-the-fly':
         pass
+    elif mode == 'smart':
+        tree = gen_tree(num_channels - 1)
+        program, clean_list = op_tree(tree)
     else:
         raise ValueError(f'Unknown mode {mode}')
 
@@ -94,8 +99,7 @@ def corr(data, pos, w_size, max_tdoa, decimate=1, mode='prepare', hyper=True):
             der = np.zeros((num_channels - 1, num_channels - 1))
             der[ind] = coef[4:]
             poly_min = np.linalg.lstsq(der + der.T, -coef[1:4], rcond=None)[0] + mean
-            return pipe.predict(poly_min), poly_min
-
+            return pipe.predict(poly_min[np.newaxis]).item(), poly_min
 
     cc = np.empty((num_channel_pairs, dw_size), np.float32)
     for i in trange(len(pos)):
@@ -109,7 +113,13 @@ def corr(data, pos, w_size, max_tdoa, decimate=1, mode='prepare', hyper=True):
             tdoas[i, 0], index = c_corr.c_corr_at(cc, tausf)
             tdoas[i, 1:] = ((tausf[:(num_channels - 1), index] + dw_size // 2) % dw_size) - dw_size // 2
         elif mode == 'on-the-fly':
-            tdoas[i, 0], tdoas[i, 1:] = c_corr.c_corr_all(cc, cc_size//2, num_channels - 1)
+            tdoas[i, 0], tij = c_corr.c_corr_all(cc, cc_size//2, num_channels - 1)
+            tdoas[i, 1:] = tij[:(num_channels - 1)]
+        elif mode == 'smart':
+            maxs = cc.max(1, keepdims=True)
+            cc /= maxs
+            val, tij = smart_gsrp(cc.T, num_channels - 1, num_channel_pairs, cc_size // 2, tree, program, clean_list)
+            tdoas[i, 0], tdoas[i, 1:] = np.log10(val * maxs.prod()), tij[:(num_channels - 1)]
         else:
             raise ValueError(f'Unknown mode {mode}')
 
@@ -122,9 +132,6 @@ def corr(data, pos, w_size, max_tdoa, decimate=1, mode='prepare', hyper=True):
         return np.hstack((np.expand_dims(pos, -1), tdoas))
 
 
-
-
-
 def main(args):
     if args.erase and os.path.isfile(args.outfile):
         print(f'{BColors.WARNING}{args.outfile} already exist and erase is not set {BColors.ENDC}')
@@ -218,9 +225,7 @@ if __name__ == "__main__":
     parser.add_argument('infile', type=str, help='The sound file to process.')
     parser.add_argument('outfile', type=str, help='The text or npy file to write results to. Each row gives the '
                                                   'position (in samples), cross-correlation product, the independent '
-                                                  'TDOAs (in samples), and TDOAs derived from the independent ones. '
-                                                  'For plots, the panes give the cross-correlation product, '
-                                                  'independent TDOAS and derived TDOAs from top to bottom.')
+                                                  'TDOAs (in samples), and TDOAs derived from the independent ones. ')
 
     group1 = parser.add_argument_group('Channels')
     group1.add_argument('-c', '--channels', type=intlist, default=None,
@@ -258,14 +263,15 @@ if __name__ == "__main__":
                                                                     '--erase is not provide, the script will exit.')
     group4.add_argument('-n', '--no-hyperres', action='store_True', help='Disable the hyper resolution evalutation of '
                                                                           'the TDOA')
-    group4.add_argument('-M', '--mode', choices={'prepare', 'on-the-fly', 'estimate', 'auto'}, default='prepare',
+    group4.add_argument('-M', '--mode', choices={'prepare', 'on-the-fly', 'smart', 'auto'}, default='prepare',
                         help=f'R|How to explore the TDOA space (default: %(default)s).\n'
                              f'{BColors.BOLD}prepare{BColors.ENDC} precomputes all the possible TDOA pairs and then '
                              f'evaluate them. All the results are save in memory.\n'
                              f'{BColors.BOLD}on-the-fly{BColors.ENDC} compute the TDOA pairs at the same time as it '
                              f'compute the loss function. Only the maximum is saved. Can be slower than '
                              f'{BColors.BOLD}prepare{BColors.ENDC}.\n'
-                             f'{BColors.BOLD}estimate{BColors.ENDC} try to reduce the number of TDOA to evaluate.\n'
+                             f'{BColors.BOLD}smart{BColors.ENDC} gradually increase the search space dimension, '
+                             f'reducing the number of tdoa to evaluate.\n'
                              f'{BColors.BOLD}auto{BColors.ENDC} automatically try to pick the right method.')
 
     args = parser.parse_args()
-- 
GitLab