Generated by Cython 3.0.10

Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.

Raw output: cmaths.c

+001: # -*- coding: utf-8 -*-
  __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
  __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 002: #cython: language_level=3
 003: #cython: wraparound=False
 004: #cython: boundscheck=False
 005: #cython: nonecheck=False
 006: #cython: cdivision=True
 007: #cython: initializedcheck=False
 008: #
 009: # Copyright © 2016-2019 Cyril Desjouy <cyril.desjouy@univ-lemans.fr>
 010: #
 011: # This file is part of ofdlib2
 012: #
 013: # ofdlib2 is free software: you can redistribute it and/or modify
 014: # it under the terms of the GNU General Public License as published by
 015: # the Free Software Foundation, either version 3 of the License, or
 016: # (at your option) any later version.
 017: #
 018: # ofdlib2 is distributed in the hope that it will be useful,
 019: # but WITHOUT ANY WARRANTY; without even the implied warranty of
 020: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 021: # GNU General Public License for more details.
 022: #
 023: # You should have received a copy of the GNU General Public License
 024: # along with ofdlib2. If not, see <http://www.gnu.org/licenses/>.
 025: #
 026: #
 027: # Creation Date : 2017-03-21 - 16:51:13
 028: """
 029: -----------
 030: Mathematic functions
 031: 
 032:     * du : derivation
 033: 
 034: @author: Cyril Desjouy
 035: """
 036: 
+037: import numpy as np
  __Pyx_TraceLine(37,0,__PYX_ERR(0, 37, __pyx_L1_error))
  __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 038: cimport numpy as np
 039: cimport cython
 040: from cython.parallel cimport prange, parallel
 041: from libc.math cimport exp, isnan, fabs
 042: 
 043: 
 044: cdef extern from "../libcfds/coefficients.h":
 045:     cdef double[6] a11c
 046:     cdef double[5][11] a11d
 047: 
 048: 
+049: cpdef Py_ssize_t argmin1d(double[::1] v):
static PyObject *__pyx_pw_6libfds_6cmaths_1argmin1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static Py_ssize_t __pyx_f_6libfds_6cmaths_argmin1d(__Pyx_memviewslice __pyx_v_v, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__11)
  __Pyx_TraceCall("argmin1d", __pyx_f[0], 49, 0, __PYX_ERR(0, 49, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("libfds.cmaths.argmin1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_1argmin1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_1argmin1d = {"argmin1d", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_1argmin1d, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_1argmin1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("argmin1d (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
  PyObject* values[1] = {0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_v)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "argmin1d") < 0)) __PYX_ERR(0, 49, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_v = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_v.memview)) __PYX_ERR(0, 49, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("argmin1d", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 49, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  __Pyx_AddTraceback("libfds.cmaths.argmin1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_argmin1d(__pyx_self, __pyx_v_v);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_argmin1d(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__11)
  __Pyx_TraceCall("argmin1d (wrapper)", __pyx_f[0], 49, 0, __PYX_ERR(0, 49, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_argmin1d(__pyx_v_v, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("libfds.cmaths.argmin1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(49,0,__PYX_ERR(0, 49, __pyx_L1_error))
/* … */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_v); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_1argmin1d, 0, __pyx_n_s_argmin1d, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_argmin1d, __pyx_t_7) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_argmin1d, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 49, __pyx_L1_error)
 050:     cdef Py_ssize_t i
+051:     cdef Py_ssize_t k = 0
  __Pyx_TraceLine(51,0,__PYX_ERR(0, 51, __pyx_L1_error))
  __pyx_v_k = 0;
+052:     cdef Py_ssize_t nx = v.shape[0]
  __Pyx_TraceLine(52,0,__PYX_ERR(0, 52, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_v.shape[0]);
 053: 
+054:     for i in range(1, nx):
  __Pyx_TraceLine(54,0,__PYX_ERR(0, 54, __pyx_L1_error))
  __pyx_t_1 = __pyx_v_nx;
  __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;
+055:         if v[i] < v[k]:
    __Pyx_TraceLine(55,0,__PYX_ERR(0, 55, __pyx_L1_error))
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = __pyx_v_k;
    __pyx_t_6 = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_4)) ))) < (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_5)) ))));
    if (__pyx_t_6) {
/* … */
    }
  }
+056:             k = i
      __Pyx_TraceLine(56,0,__PYX_ERR(0, 56, __pyx_L1_error))
      __pyx_v_k = __pyx_v_i;
+057:     return k
  __Pyx_TraceLine(57,0,__PYX_ERR(0, 57, __pyx_L1_error))
  __pyx_r = __pyx_v_k;
  goto __pyx_L0;
 058: 
 059: 
+060: cpdef Py_ssize_t argmax1d(double[::1] v):
static PyObject *__pyx_pw_6libfds_6cmaths_3argmax1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static Py_ssize_t __pyx_f_6libfds_6cmaths_argmax1d(__Pyx_memviewslice __pyx_v_v, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__12)
  __Pyx_TraceCall("argmax1d", __pyx_f[0], 60, 0, __PYX_ERR(0, 60, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("libfds.cmaths.argmax1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_3argmax1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_3argmax1d = {"argmax1d", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_3argmax1d, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_3argmax1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("argmax1d (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
  PyObject* values[1] = {0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_v)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "argmax1d") < 0)) __PYX_ERR(0, 60, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_v = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_v.memview)) __PYX_ERR(0, 60, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("argmax1d", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 60, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  __Pyx_AddTraceback("libfds.cmaths.argmax1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_2argmax1d(__pyx_self, __pyx_v_v);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_2argmax1d(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__12)
  __Pyx_TraceCall("argmax1d (wrapper)", __pyx_f[0], 60, 0, __PYX_ERR(0, 60, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_argmax1d(__pyx_v_v, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("libfds.cmaths.argmax1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(60,0,__PYX_ERR(0, 60, __pyx_L1_error))

  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_3argmax1d, 0, __pyx_n_s_argmax1d, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_argmax1d, __pyx_t_7) < 0) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
/* … */
  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_argmax1d, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 60, __pyx_L1_error)
 061:     cdef Py_ssize_t i
+062:     cdef Py_ssize_t k = 0
  __Pyx_TraceLine(62,0,__PYX_ERR(0, 62, __pyx_L1_error))
  __pyx_v_k = 0;
+063:     cdef Py_ssize_t nx = v.shape[0]
  __Pyx_TraceLine(63,0,__PYX_ERR(0, 63, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_v.shape[0]);
 064: 
+065:     for i in range(1, nx):
  __Pyx_TraceLine(65,0,__PYX_ERR(0, 65, __pyx_L1_error))
  __pyx_t_1 = __pyx_v_nx;
  __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;
+066:         if v[i] > v[k]:
    __Pyx_TraceLine(66,0,__PYX_ERR(0, 66, __pyx_L1_error))
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = __pyx_v_k;
    __pyx_t_6 = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_4)) ))) > (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_5)) ))));
    if (__pyx_t_6) {
/* … */
    }
  }
+067:             k = i
      __Pyx_TraceLine(67,0,__PYX_ERR(0, 67, __pyx_L1_error))
      __pyx_v_k = __pyx_v_i;
+068:     return k
  __Pyx_TraceLine(68,0,__PYX_ERR(0, 68, __pyx_L1_error))
  __pyx_r = __pyx_v_k;
  goto __pyx_L0;
 069: 
 070: 
+071: cpdef double[::1] du1d(double[::1] v, double dx = 1.):
static PyObject *__pyx_pw_6libfds_6cmaths_5du1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_du1d(__Pyx_memviewslice __pyx_v_v, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6libfds_6cmaths_du1d *__pyx_optional_args) {
  double __pyx_v_dx = ((double)1.);
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  double __pyx_v_odx;
  __Pyx_memviewslice __pyx_v_dv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__13)
  __Pyx_TraceCall("du1d", __pyx_f[0], 71, 0, __PYX_ERR(0, 71, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_dx = __pyx_optional_args->dx;
    }
  }
/* … */
  /* 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_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.du1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dv, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_5du1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6libfds_6cmaths_4du1d, "\n        Returns derivative of v. The step dx can be provided.\n    ");
static PyMethodDef __pyx_mdef_6libfds_6cmaths_5du1d = {"du1d", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_5du1d, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6libfds_6cmaths_4du1d};
static PyObject *__pyx_pw_6libfds_6cmaths_5du1d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dx;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("du1d (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_dx,0};
  PyObject* values[2] = {0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_v)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dx);
          if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "du1d") < 0)) __PYX_ERR(0, 71, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_v.memview)) __PYX_ERR(0, 71, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_dx = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
    } else {
      __pyx_v_dx = ((double)1.);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("du1d", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 71, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  __Pyx_AddTraceback("libfds.cmaths.du1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_4du1d(__pyx_self, __pyx_v_v, __pyx_v_dx);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_4du1d(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_v, double __pyx_v_dx) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__13)
  __Pyx_TraceCall("du1d (wrapper)", __pyx_f[0], 71, 0, __PYX_ERR(0, 71, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.dx = __pyx_v_dx;
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_du1d(__pyx_v_v, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 71, __pyx_L1_error)
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("libfds.cmaths.du1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(71,0,__PYX_ERR(0, 71, __pyx_L1_error))
/* … */
  __pyx_tuple__40 = PyTuple_Pack(2, __pyx_n_s_v, __pyx_n_s_dx); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_du1d, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 71, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_5du1d, 0, __pyx_n_s_du1d, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__41);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_du1d, __pyx_t_7) < 0) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_float_1_); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
 072:     """
 073:         Returns derivative of v. The step dx can be provided.
 074:     """
 075:     cdef Py_ssize_t i
+076:     cdef Py_ssize_t n = v.shape[0]
  __Pyx_TraceLine(76,0,__PYX_ERR(0, 76, __pyx_L1_error))
  __pyx_v_n = (__pyx_v_v.shape[0]);
+077:     cdef double odx = 1. / dx
  __Pyx_TraceLine(77,0,__PYX_ERR(0, 77, __pyx_L1_error))
  __pyx_v_odx = (1. / __pyx_v_dx);
+078:     cdef double[::1] dv = np.zeros_like(v)
  __Pyx_TraceLine(78,0,__PYX_ERR(0, 78, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 079: 
 080: 
+081:     for i in range(5, n - 5):
  __Pyx_TraceLine(81,0,__PYX_ERR(0, 81, __pyx_L1_error))
  __pyx_t_7 = (__pyx_v_n - 5);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 5; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;
+082:         dv[i] = (a11c[1] * (v[i+1] - v[i-1]) +
    __Pyx_TraceLine(82,0,__PYX_ERR(0, 82, __pyx_L1_error))
    __pyx_t_10 = (__pyx_v_i + 1);
    __pyx_t_11 = (__pyx_v_i - 1);
/* … */
    __Pyx_TraceLine(82,0,__PYX_ERR(0, 82, __pyx_L1_error))
    __pyx_t_20 = __pyx_v_i;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dv.data) + __pyx_t_20)) )) = (((((((a11c[1]) * ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_10)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_11)) ))))) + ((a11c[2]) * ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_12)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_13)) )))))) + ((a11c[3]) * ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_14)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_15)) )))))) + ((a11c[4]) * ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_16)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_17)) )))))) + ((a11c[5]) * ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_18)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_19)) )))))) * __pyx_v_odx);
  }
+083:                  a11c[2] * (v[i+2] - v[i-2]) +
    __Pyx_TraceLine(83,0,__PYX_ERR(0, 83, __pyx_L1_error))
    __pyx_t_12 = (__pyx_v_i + 2);
    __pyx_t_13 = (__pyx_v_i - 2);
+084:                  a11c[3] * (v[i+3] - v[i-3]) +
    __Pyx_TraceLine(84,0,__PYX_ERR(0, 84, __pyx_L1_error))
    __pyx_t_14 = (__pyx_v_i + 3);
    __pyx_t_15 = (__pyx_v_i - 3);
+085:                  a11c[4] * (v[i+4] - v[i-4]) +
    __Pyx_TraceLine(85,0,__PYX_ERR(0, 85, __pyx_L1_error))
    __pyx_t_16 = (__pyx_v_i + 4);
    __pyx_t_17 = (__pyx_v_i - 4);
+086:                  a11c[5] * (v[i+5] - v[i-5])) * odx
    __Pyx_TraceLine(86,0,__PYX_ERR(0, 86, __pyx_L1_error))
    __pyx_t_18 = (__pyx_v_i + 5);
    __pyx_t_19 = (__pyx_v_i - 5);
 087: 
+088:     for i in range(0, 5):
  __Pyx_TraceLine(88,0,__PYX_ERR(0, 88, __pyx_L1_error))
  for (__pyx_t_7 = 0; __pyx_t_7 < 5; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;
+089:         dv[i] = (a11d[i][0] * v[0] +
    __Pyx_TraceLine(89,0,__PYX_ERR(0, 89, __pyx_L1_error))
    __pyx_t_19 = 0;
/* … */
    __Pyx_TraceLine(89,0,__PYX_ERR(0, 89, __pyx_L1_error))
    __pyx_t_21 = __pyx_v_i;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dv.data) + __pyx_t_21)) )) = ((((((((((((((a11d[__pyx_v_i])[0]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_19)) )))) + (((a11d[__pyx_v_i])[1]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_18)) ))))) + (((a11d[__pyx_v_i])[2]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_17)) ))))) + (((a11d[__pyx_v_i])[3]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_16)) ))))) + (((a11d[__pyx_v_i])[4]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_15)) ))))) + (((a11d[__pyx_v_i])[5]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_14)) ))))) + (((a11d[__pyx_v_i])[6]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_13)) ))))) + (((a11d[__pyx_v_i])[7]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_12)) ))))) + (((a11d[__pyx_v_i])[8]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_11)) ))))) + (((a11d[__pyx_v_i])[9]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_10)) ))))) + (((a11d[__pyx_v_i])[10]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_20)) ))))) * __pyx_v_odx);
  }
+090:                  a11d[i][1] * v[1] +
    __Pyx_TraceLine(90,0,__PYX_ERR(0, 90, __pyx_L1_error))
    __pyx_t_18 = 1;
+091:                  a11d[i][2] * v[2] +
    __Pyx_TraceLine(91,0,__PYX_ERR(0, 91, __pyx_L1_error))
    __pyx_t_17 = 2;
+092:                  a11d[i][3] * v[3] +
    __Pyx_TraceLine(92,0,__PYX_ERR(0, 92, __pyx_L1_error))
    __pyx_t_16 = 3;
+093:                  a11d[i][4] * v[4] +
    __Pyx_TraceLine(93,0,__PYX_ERR(0, 93, __pyx_L1_error))
    __pyx_t_15 = 4;
+094:                  a11d[i][5] * v[5] +
    __Pyx_TraceLine(94,0,__PYX_ERR(0, 94, __pyx_L1_error))
    __pyx_t_14 = 5;
+095:                  a11d[i][6] * v[6] +
    __Pyx_TraceLine(95,0,__PYX_ERR(0, 95, __pyx_L1_error))
    __pyx_t_13 = 6;
+096:                  a11d[i][7] * v[7] +
    __Pyx_TraceLine(96,0,__PYX_ERR(0, 96, __pyx_L1_error))
    __pyx_t_12 = 7;
+097:                  a11d[i][8] * v[8] +
    __Pyx_TraceLine(97,0,__PYX_ERR(0, 97, __pyx_L1_error))
    __pyx_t_11 = 8;
+098:                  a11d[i][9] * v[9] +
    __Pyx_TraceLine(98,0,__PYX_ERR(0, 98, __pyx_L1_error))
    __pyx_t_10 = 9;
+099:                  a11d[i][10] * v[10]) * odx
    __Pyx_TraceLine(99,0,__PYX_ERR(0, 99, __pyx_L1_error))
    __pyx_t_20 = 10;
 100: 
+101:     for i in range(n-1, n-6, -1):
  __Pyx_TraceLine(101,0,__PYX_ERR(0, 101, __pyx_L1_error))
  __pyx_t_7 = (__pyx_v_n - 6);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = (__pyx_v_n - 1); __pyx_t_9 > __pyx_t_8; __pyx_t_9-=1) {
    __pyx_v_i = __pyx_t_9;
+102:         dv[i] = - (a11d[n-i-1][0] * v[n-1] +
    __Pyx_TraceLine(102,0,__PYX_ERR(0, 102, __pyx_L1_error))
    __pyx_t_20 = (__pyx_v_n - 1);
/* … */
    __Pyx_TraceLine(102,0,__PYX_ERR(0, 102, __pyx_L1_error))
    __pyx_t_21 = __pyx_v_i;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dv.data) + __pyx_t_21)) )) = ((-(((((((((((((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[0]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_20)) )))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[1]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_10)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[2]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_11)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[3]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_12)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[4]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_13)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[5]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_14)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[6]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_15)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[7]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_16)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[8]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_17)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[9]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_18)) ))))) + (((a11d[((__pyx_v_n - __pyx_v_i) - 1)])[10]) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_19)) )))))) * __pyx_v_odx);
  }
+103:                    a11d[n-i-1][1] * v[n-2] +
    __Pyx_TraceLine(103,0,__PYX_ERR(0, 103, __pyx_L1_error))
    __pyx_t_10 = (__pyx_v_n - 2);
+104:                    a11d[n-i-1][2] * v[n-3] +
    __Pyx_TraceLine(104,0,__PYX_ERR(0, 104, __pyx_L1_error))
    __pyx_t_11 = (__pyx_v_n - 3);
+105:                    a11d[n-i-1][3] * v[n-4] +
    __Pyx_TraceLine(105,0,__PYX_ERR(0, 105, __pyx_L1_error))
    __pyx_t_12 = (__pyx_v_n - 4);
+106:                    a11d[n-i-1][4] * v[n-5] +
    __Pyx_TraceLine(106,0,__PYX_ERR(0, 106, __pyx_L1_error))
    __pyx_t_13 = (__pyx_v_n - 5);
+107:                    a11d[n-i-1][5] * v[n-6] +
    __Pyx_TraceLine(107,0,__PYX_ERR(0, 107, __pyx_L1_error))
    __pyx_t_14 = (__pyx_v_n - 6);
+108:                    a11d[n-i-1][6] * v[n-7] +
    __Pyx_TraceLine(108,0,__PYX_ERR(0, 108, __pyx_L1_error))
    __pyx_t_15 = (__pyx_v_n - 7);
+109:                    a11d[n-i-1][7] * v[n-8] +
    __Pyx_TraceLine(109,0,__PYX_ERR(0, 109, __pyx_L1_error))
    __pyx_t_16 = (__pyx_v_n - 8);
+110:                    a11d[n-i-1][8] * v[n-9] +
    __Pyx_TraceLine(110,0,__PYX_ERR(0, 110, __pyx_L1_error))
    __pyx_t_17 = (__pyx_v_n - 9);
+111:                    a11d[n-i-1][9] * v[n-10] +
    __Pyx_TraceLine(111,0,__PYX_ERR(0, 111, __pyx_L1_error))
    __pyx_t_18 = (__pyx_v_n - 10);
+112:                    a11d[n-i-1][10] * v[n-11]) * odx
    __Pyx_TraceLine(112,0,__PYX_ERR(0, 112, __pyx_L1_error))
    __pyx_t_19 = (__pyx_v_n - 11);
 113: 
+114:     return dv
  __Pyx_TraceLine(114,0,__PYX_ERR(0, 114, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_dv, 1);
  __pyx_r = __pyx_v_dv;
  goto __pyx_L0;
 115: 
 116: 
+117: cpdef double[:, ::1] du2d(double[:, ::1] v, int axis, double dx = 1., double dy = 1.):
static PyObject *__pyx_pw_6libfds_6cmaths_7du2d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_du2d(__Pyx_memviewslice __pyx_v_v, int __pyx_v_axis, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6libfds_6cmaths_du2d *__pyx_optional_args) {
  double __pyx_v_dx = ((double)1.);
  double __pyx_v_dy = ((double)1.);
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__14)
  __Pyx_TraceCall("du2d", __pyx_f[0], 117, 0, __PYX_ERR(0, 117, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_dx = __pyx_optional_args->dx;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_dy = __pyx_optional_args->dy;
      }
    }
  }
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_4);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.du2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_7du2d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6libfds_6cmaths_6du2d, "\n        Returns derivative of v following provided axis. The steps dx and dy can be provided.\n    ");
static PyMethodDef __pyx_mdef_6libfds_6cmaths_7du2d = {"du2d", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_7du2d, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6libfds_6cmaths_6du2d};
static PyObject *__pyx_pw_6libfds_6cmaths_7du2d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_axis;
  double __pyx_v_dx;
  double __pyx_v_dy;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("du2d (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_axis,&__pyx_n_s_dx,&__pyx_n_s_dy,0};
  PyObject* values[4] = {0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_v)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_axis)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("du2d", 0, 2, 4, 1); __PYX_ERR(0, 117, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dx);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dy);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "du2d") < 0)) __PYX_ERR(0, 117, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_v.memview)) __PYX_ERR(0, 117, __pyx_L3_error)
    __pyx_v_axis = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dx = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error)
    } else {
      __pyx_v_dx = ((double)1.);
    }
    if (values[3]) {
      __pyx_v_dy = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_dy == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error)
    } else {
      __pyx_v_dy = ((double)1.);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("du2d", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 117, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  __Pyx_AddTraceback("libfds.cmaths.du2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_6du2d(__pyx_self, __pyx_v_v, __pyx_v_axis, __pyx_v_dx, __pyx_v_dy);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_6du2d(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_v, int __pyx_v_axis, double __pyx_v_dx, double __pyx_v_dy) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__14)
  __Pyx_TraceCall("du2d (wrapper)", __pyx_f[0], 117, 0, __PYX_ERR(0, 117, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.dx = __pyx_v_dx;
  __pyx_t_2.dy = __pyx_v_dy;
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_v, __pyx_v_axis, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 117, __pyx_L1_error)
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_1, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("libfds.cmaths.du2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(117,0,__PYX_ERR(0, 117, __pyx_L1_error))
/* … */
  __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_v, __pyx_n_s_axis, __pyx_n_s_dx, __pyx_n_s_dy); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);
  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_du2d, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 117, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_7du2d, 0, __pyx_n_s_du2d, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__43);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_du2d, __pyx_t_7) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_tuple__43 = PyTuple_Pack(2, __pyx_float_1_, __pyx_float_1_); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
 118:     """
 119:         Returns derivative of v following provided axis. The steps dx and dy can be provided.
 120:     """
 121: 
+122:     if axis == 0:
  __Pyx_TraceLine(122,0,__PYX_ERR(0, 122, __pyx_L1_error))
  switch (__pyx_v_axis) {
    case 0:
/* … */
    break;
    case 1:
+123:         return _du2d_x(v, dx)
    __Pyx_TraceLine(123,0,__PYX_ERR(0, 123, __pyx_L1_error))
    __pyx_t_2.__pyx_n = 1;
    __pyx_t_2.dx = __pyx_v_dx;
    __pyx_t_1 = __pyx_f_6libfds_6cmaths__du2d_x(__pyx_v_v, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 123, __pyx_L1_error)
    __pyx_r = __pyx_t_1;
    __pyx_t_1.memview = NULL;
    __pyx_t_1.data = NULL;
    goto __pyx_L0;
+124:     elif axis == 1:
    break;
    default: break;
  }
+125:         return _du2d_y(v, dy)
    __Pyx_TraceLine(125,0,__PYX_ERR(0, 125, __pyx_L1_error))
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.dy = __pyx_v_dy;
    __pyx_t_1 = __pyx_f_6libfds_6cmaths__du2d_y(__pyx_v_v, &__pyx_t_3); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 125, __pyx_L1_error)
    __pyx_r = __pyx_t_1;
    __pyx_t_1.memview = NULL;
    __pyx_t_1.data = NULL;
    goto __pyx_L0;
 126: 
+127:     raise ValueError('Wrong axis')
  __Pyx_TraceLine(127,0,__PYX_ERR(0, 127, __pyx_L1_error))
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __PYX_ERR(0, 127, __pyx_L1_error)
/* … */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_Wrong_axis); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
 128: 
 129: 
+130: cpdef double[:, :, ::1] du3d(double[:, :, ::1] v, int axis, double dx = 1., double dy = 1., double dz = 1.):
static PyObject *__pyx_pw_6libfds_6cmaths_9du3d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_du3d(__Pyx_memviewslice __pyx_v_v, int __pyx_v_axis, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6libfds_6cmaths_du3d *__pyx_optional_args) {
  double __pyx_v_dx = ((double)1.);
  double __pyx_v_dy = ((double)1.);
  double __pyx_v_dz = ((double)1.);
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__16)
  __Pyx_TraceCall("du3d", __pyx_f[0], 130, 0, __PYX_ERR(0, 130, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_dx = __pyx_optional_args->dx;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_dy = __pyx_optional_args->dy;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_dz = __pyx_optional_args->dz;
        }
      }
    }
  }
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_5);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.du3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_9du3d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6libfds_6cmaths_8du3d, "\n        Returns derivative of v following provided axis. The steps dx, dy and dz can be provided.\n    ");
static PyMethodDef __pyx_mdef_6libfds_6cmaths_9du3d = {"du3d", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_9du3d, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6libfds_6cmaths_8du3d};
static PyObject *__pyx_pw_6libfds_6cmaths_9du3d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_axis;
  double __pyx_v_dx;
  double __pyx_v_dy;
  double __pyx_v_dz;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("du3d (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_axis,&__pyx_n_s_dx,&__pyx_n_s_dy,&__pyx_n_s_dz,0};
  PyObject* values[5] = {0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_v)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_axis)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("du3d", 0, 2, 5, 1); __PYX_ERR(0, 130, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dx);
          if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dy);
          if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dz);
          if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "du3d") < 0)) __PYX_ERR(0, 130, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_v.memview)) __PYX_ERR(0, 130, __pyx_L3_error)
    __pyx_v_axis = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dx = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
    } else {
      __pyx_v_dx = ((double)1.);
    }
    if (values[3]) {
      __pyx_v_dy = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_dy == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
    } else {
      __pyx_v_dy = ((double)1.);
    }
    if (values[4]) {
      __pyx_v_dz = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_dz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
    } else {
      __pyx_v_dz = ((double)1.);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("du3d", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 130, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  __Pyx_AddTraceback("libfds.cmaths.du3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_8du3d(__pyx_self, __pyx_v_v, __pyx_v_axis, __pyx_v_dx, __pyx_v_dy, __pyx_v_dz);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_8du3d(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_v, int __pyx_v_axis, double __pyx_v_dx, double __pyx_v_dy, double __pyx_v_dz) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__16)
  __Pyx_TraceCall("du3d (wrapper)", __pyx_f[0], 130, 0, __PYX_ERR(0, 130, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.dx = __pyx_v_dx;
  __pyx_t_2.dy = __pyx_v_dy;
  __pyx_t_2.dz = __pyx_v_dz;
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_v, __pyx_v_axis, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 130, __pyx_L1_error)
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_1, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("libfds.cmaths.du3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(130,0,__PYX_ERR(0, 130, __pyx_L1_error))
/* … */
  __pyx_tuple__44 = PyTuple_Pack(5, __pyx_n_s_v, __pyx_n_s_axis, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);
  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_du3d, 130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 130, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_9du3d, 0, __pyx_n_s_du3d, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__45);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_du3d, __pyx_t_7) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_tuple__45 = PyTuple_Pack(3, __pyx_float_1_, __pyx_float_1_, __pyx_float_1_); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);
 131:     """
 132:         Returns derivative of v following provided axis. The steps dx, dy and dz can be provided.
 133:     """
 134: 
+135:     if axis == 0:
  __Pyx_TraceLine(135,0,__PYX_ERR(0, 135, __pyx_L1_error))
  switch (__pyx_v_axis) {
    case 0:
/* … */
    break;
    case 1:
+136:         return _du3d_x(v, dx)
    __Pyx_TraceLine(136,0,__PYX_ERR(0, 136, __pyx_L1_error))
    __pyx_t_2.__pyx_n = 1;
    __pyx_t_2.dx = __pyx_v_dx;
    __pyx_t_1 = __pyx_f_6libfds_6cmaths__du3d_x(__pyx_v_v, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 136, __pyx_L1_error)
    __pyx_r = __pyx_t_1;
    __pyx_t_1.memview = NULL;
    __pyx_t_1.data = NULL;
    goto __pyx_L0;
+137:     elif axis == 1:
    break;
    case 2:
+138:         return _du3d_y(v, dy)
    __Pyx_TraceLine(138,0,__PYX_ERR(0, 138, __pyx_L1_error))
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.dy = __pyx_v_dy;
    __pyx_t_1 = __pyx_f_6libfds_6cmaths__du3d_y(__pyx_v_v, &__pyx_t_3); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 138, __pyx_L1_error)
    __pyx_r = __pyx_t_1;
    __pyx_t_1.memview = NULL;
    __pyx_t_1.data = NULL;
    goto __pyx_L0;
+139:     elif axis == 2:
    break;
    default: break;
  }
+140:         return _du3d_z(v, dz)
    __Pyx_TraceLine(140,0,__PYX_ERR(0, 140, __pyx_L1_error))
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.dz = __pyx_v_dz;
    __pyx_t_1 = __pyx_f_6libfds_6cmaths__du3d_z(__pyx_v_v, &__pyx_t_4); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 140, __pyx_L1_error)
    __pyx_r = __pyx_t_1;
    __pyx_t_1.memview = NULL;
    __pyx_t_1.data = NULL;
    goto __pyx_L0;
 141: 
+142:     raise ValueError('Wrong axis')
  __Pyx_TraceLine(142,0,__PYX_ERR(0, 142, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __PYX_ERR(0, 142, __pyx_L1_error)
 143: 
 144: 
+145: cpdef double[::1] odu(double[::1] v):
static PyObject *__pyx_pw_6libfds_6cmaths_11odu(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_odu(__Pyx_memviewslice __pyx_v_v, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  __Pyx_memviewslice __pyx_v_dv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__17)
  __Pyx_TraceCall("odu", __pyx_f[0], 145, 0, __PYX_ERR(0, 145, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.odu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dv, 1);
  __Pyx_TraceReturn(Py_None, 0);
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_11odu(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_11odu = {"odu", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_11odu, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_11odu(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("odu (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
  PyObject* values[1] = {0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_v)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "odu") < 0)) __PYX_ERR(0, 145, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_v = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_v.memview)) __PYX_ERR(0, 145, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("odu", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 145, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  __Pyx_AddTraceback("libfds.cmaths.odu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_10odu(__pyx_self, __pyx_v_v);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_10odu(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__17)
  __Pyx_TraceCall("odu (wrapper)", __pyx_f[0], 145, 0, __PYX_ERR(0, 145, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_odu(__pyx_v_v, 0); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 145, __pyx_L1_error)
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("libfds.cmaths.odu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(145,0,__PYX_ERR(0, 145, __pyx_L1_error))

  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_11odu, 0, __pyx_n_s_odu, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_odu, __pyx_t_7) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
/* … */
  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_odu, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 145, __pyx_L1_error)
 146: 
 147:     cdef Py_ssize_t i
+148:     cdef Py_ssize_t n = v.shape[0]
  __Pyx_TraceLine(148,0,__PYX_ERR(0, 148, __pyx_L1_error))
  __pyx_v_n = (__pyx_v_v.shape[0]);
 149:     cdef double[::1] dv
 150: 
+151:     dv = du1d(v, 1.)
  __Pyx_TraceLine(151,0,__PYX_ERR(0, 151, __pyx_L1_error))
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.dx = 1.;
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_du1d(__pyx_v_v, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 151, __pyx_L1_error)
  __pyx_v_dv = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;
 152: 
+153:     for i in range(n):
  __Pyx_TraceLine(153,0,__PYX_ERR(0, 153, __pyx_L1_error))
  __pyx_t_3 = __pyx_v_n;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;
+154:         dv[i] = 1. / dv[i]
    __Pyx_TraceLine(154,0,__PYX_ERR(0, 154, __pyx_L1_error))
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_7 = __pyx_v_i;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dv.data) + __pyx_t_7)) )) = (1. / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dv.data) + __pyx_t_6)) ))));
  }
 155: 
+156:     return dv
  __Pyx_TraceLine(156,0,__PYX_ERR(0, 156, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_dv, 1);
  __pyx_r = __pyx_v_dv;
  goto __pyx_L0;
 157: 
 158: 
+159: cpdef double[::1] mult(double[::1] v, double a):
static PyObject *__pyx_pw_6libfds_6cmaths_13mult(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_mult(__Pyx_memviewslice __pyx_v_v, double __pyx_v_a, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__18)
  __Pyx_TraceCall("mult", __pyx_f[0], 159, 0, __PYX_ERR(0, 159, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.mult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_13mult(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_13mult = {"mult", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_13mult, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_13mult(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_a;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mult (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_a,0};
  PyObject* values[2] = {0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_v)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("mult", 1, 2, 2, 1); __PYX_ERR(0, 159, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mult") < 0)) __PYX_ERR(0, 159, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_v = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_v.memview)) __PYX_ERR(0, 159, __pyx_L3_error)
    __pyx_v_a = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mult", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 159, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  __Pyx_AddTraceback("libfds.cmaths.mult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_12mult(__pyx_self, __pyx_v_v, __pyx_v_a);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_12mult(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_v, double __pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__18)
  __Pyx_TraceCall("mult (wrapper)", __pyx_f[0], 159, 0, __PYX_ERR(0, 159, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_mult(__pyx_v_v, __pyx_v_a, 0); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 159, __pyx_L1_error)
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("libfds.cmaths.mult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(159,0,__PYX_ERR(0, 159, __pyx_L1_error))
/* … */
  __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_v, __pyx_n_s_a); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_13mult, 0, __pyx_n_s_mult, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mult, __pyx_t_7) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_mult, 159, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 159, __pyx_L1_error)
 160: 
 161:     cdef Py_ssize_t i
+162:     cdef Py_ssize_t n = v.shape[0]
  __Pyx_TraceLine(162,0,__PYX_ERR(0, 162, __pyx_L1_error))
  __pyx_v_n = (__pyx_v_v.shape[0]);
+163:     cdef double[::1] out = np.zeros_like(v)
  __Pyx_TraceLine(163,0,__PYX_ERR(0, 163, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 164: 
+165:     for i in range(n):
  __Pyx_TraceLine(165,0,__PYX_ERR(0, 165, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_n;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;
+166:         out[i] = a * v[i]
    __Pyx_TraceLine(166,0,__PYX_ERR(0, 166, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = __pyx_v_i;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_out.data) + __pyx_t_11)) )) = (__pyx_v_a * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_10)) ))));
  }
 167: 
+168:     return out
  __Pyx_TraceLine(168,0,__PYX_ERR(0, 168, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 169: 
 170: 
+171: cpdef void mult_inplace(double[::1] out, double[::1] v, double a):
static PyObject *__pyx_pw_6libfds_6cmaths_15mult_inplace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static void __pyx_f_6libfds_6cmaths_mult_inplace(__Pyx_memviewslice __pyx_v_out, __Pyx_memviewslice __pyx_v_v, double __pyx_v_a, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__19)
  __Pyx_TraceCall("mult_inplace", __pyx_f[0], 171, 0, __PYX_ERR(0, 171, __pyx_L1_error));
/* … */
  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("libfds.cmaths.mult_inplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_15mult_inplace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_15mult_inplace = {"mult_inplace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_15mult_inplace, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_15mult_inplace(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_a;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mult_inplace (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_out,&__pyx_n_s_v,&__pyx_n_s_a,0};
  PyObject* values[3] = {0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_out)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_v)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("mult_inplace", 1, 3, 3, 1); __PYX_ERR(0, 171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("mult_inplace", 1, 3, 3, 2); __PYX_ERR(0, 171, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mult_inplace") < 0)) __PYX_ERR(0, 171, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_out = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out.memview)) __PYX_ERR(0, 171, __pyx_L3_error)
    __pyx_v_v = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_v.memview)) __PYX_ERR(0, 171, __pyx_L3_error)
    __pyx_v_a = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mult_inplace", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 171, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  __Pyx_AddTraceback("libfds.cmaths.mult_inplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_14mult_inplace(__pyx_self, __pyx_v_out, __pyx_v_v, __pyx_v_a);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_v, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_14mult_inplace(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_out, __Pyx_memviewslice __pyx_v_v, double __pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__19)
  __Pyx_TraceCall("mult_inplace (wrapper)", __pyx_f[0], 171, 0, __PYX_ERR(0, 171, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_f_6libfds_6cmaths_mult_inplace(__pyx_v_out, __pyx_v_v, __pyx_v_a, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error)
  __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __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("libfds.cmaths.mult_inplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(171,0,__PYX_ERR(0, 171, __pyx_L1_error))
/* … */
  __pyx_tuple__47 = PyTuple_Pack(3, __pyx_n_s_out, __pyx_n_s_v, __pyx_n_s_a); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_15mult_inplace, 0, __pyx_n_s_mult_inplace, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mult_inplace, __pyx_t_7) < 0) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_mult_inplace, 171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 171, __pyx_L1_error)
 172: 
 173:     cdef Py_ssize_t i
+174:     cdef Py_ssize_t n = v.shape[0]
  __Pyx_TraceLine(174,0,__PYX_ERR(0, 174, __pyx_L1_error))
  __pyx_v_n = (__pyx_v_v.shape[0]);
 175: 
+176:     for i in range(n):
  __Pyx_TraceLine(176,0,__PYX_ERR(0, 176, __pyx_L1_error))
  __pyx_t_1 = __pyx_v_n;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
+177:         out[i] = a * v[i]
    __Pyx_TraceLine(177,0,__PYX_ERR(0, 177, __pyx_L1_error))
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = __pyx_v_i;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_out.data) + __pyx_t_5)) )) = (__pyx_v_a * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_v.data) + __pyx_t_4)) ))));
  }
 178: 
 179: 
+180: cpdef curvilinear2d_trans(double[:, ::1] xp, double[:, ::1] yp,
static PyObject *__pyx_pw_6libfds_6cmaths_17curvilinear2d_trans(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_6libfds_6cmaths_curvilinear2d_trans(__Pyx_memviewslice __pyx_v_xp, __Pyx_memviewslice __pyx_v_yp, __Pyx_memviewslice __pyx_v_xn, __Pyx_memviewslice __pyx_v_yn, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  __Pyx_memviewslice __pyx_v_dxp_dxn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxp_dyn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyp_dxn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyp_dyn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__20)
  __Pyx_TraceCall("curvilinear2d_trans", __pyx_f[0], 180, 0, __PYX_ERR(0, 180, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_XDECREF(__pyx_t_26);
  __Pyx_AddTraceback("libfds.cmaths.curvilinear2d_trans", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxp_dxn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxp_dyn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyp_dxn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyp_dyn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dyp, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_17curvilinear2d_trans(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_17curvilinear2d_trans = {"curvilinear2d_trans", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_17curvilinear2d_trans, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_17curvilinear2d_trans(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_xp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_yp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_yn = { 0, 0, { 0 }, { 0 }, { 0 } };
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("curvilinear2d_trans (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xp,&__pyx_n_s_yp,&__pyx_n_s_xn,&__pyx_n_s_yn,0};
  PyObject* values[4] = {0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_yp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear2d_trans", 1, 4, 4, 1); __PYX_ERR(0, 180, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xn)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear2d_trans", 1, 4, 4, 2); __PYX_ERR(0, 180, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_yn)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear2d_trans", 1, 4, 4, 3); __PYX_ERR(0, 180, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "curvilinear2d_trans") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
    }
    __pyx_v_xp = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xp.memview)) __PYX_ERR(0, 180, __pyx_L3_error)
    __pyx_v_yp = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_yp.memview)) __PYX_ERR(0, 180, __pyx_L3_error)
    __pyx_v_xn = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xn.memview)) __PYX_ERR(0, 181, __pyx_L3_error)
    __pyx_v_yn = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_yn.memview)) __PYX_ERR(0, 181, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("curvilinear2d_trans", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 180, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_xp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_yp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_xn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_yn, 1);
  __Pyx_AddTraceback("libfds.cmaths.curvilinear2d_trans", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_16curvilinear2d_trans(__pyx_self, __pyx_v_xp, __pyx_v_yp, __pyx_v_xn, __pyx_v_yn);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_xp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_yp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_xn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_yn, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_16curvilinear2d_trans(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xp, __Pyx_memviewslice __pyx_v_yp, __Pyx_memviewslice __pyx_v_xn, __Pyx_memviewslice __pyx_v_yn) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__20)
  __Pyx_TraceCall("curvilinear2d_trans (wrapper)", __pyx_f[0], 180, 0, __PYX_ERR(0, 180, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_curvilinear2d_trans(__pyx_v_xp, __pyx_v_yp, __pyx_v_xn, __pyx_v_yn, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __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("libfds.cmaths.curvilinear2d_trans", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(180,0,__PYX_ERR(0, 180, __pyx_L1_error))
/* … */
  __pyx_tuple__48 = PyTuple_Pack(4, __pyx_n_s_xp, __pyx_n_s_yp, __pyx_n_s_xn, __pyx_n_s_yn); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_17curvilinear2d_trans, 0, __pyx_n_s_curvilinear2d_trans, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_curvilinear2d_trans, __pyx_t_7) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_curvilinear2d_trans, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 180, __pyx_L1_error)
 181:                           double[:, ::1] xn, double[:, ::1] yn):
 182: 
+183:     cdef Py_ssize_t nx = xp.shape[0]
  __Pyx_TraceLine(183,0,__PYX_ERR(0, 183, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_xp.shape[0]);
+184:     cdef Py_ssize_t ny = yp.shape[1]
  __Pyx_TraceLine(184,0,__PYX_ERR(0, 184, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_yp.shape[1]);
 185:     cdef double[:, ::1] dxp_dxn, dxp_dyn, dyp_dxn, dyp_dyn
+186:     cdef double[:, ::1] J = np.empty_like(xp)
  __Pyx_TraceLine(186,0,__PYX_ERR(0, 186, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_J = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+187:     cdef double[:, ::1] dxn_dxp = np.empty_like(xp)
  __Pyx_TraceLine(187,0,__PYX_ERR(0, 187, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dxn_dxp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+188:     cdef double[:, ::1] dxn_dyp = np.empty_like(xp)
  __Pyx_TraceLine(188,0,__PYX_ERR(0, 188, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dxn_dyp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+189:     cdef double[:, ::1] dyn_dxp = np.empty_like(xp)
  __Pyx_TraceLine(189,0,__PYX_ERR(0, 189, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dyn_dxp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+190:     cdef double[:, ::1] dyn_dyp = np.empty_like(xp)
  __Pyx_TraceLine(190,0,__PYX_ERR(0, 190, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dyn_dyp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 191: 
 192:     # Can be optimized : (xn, yn) are actually 1d !
+193:     dxp_dxn = cdiv2d(du2d(xp, axis=0), du2d(xn, axis=0))
  __Pyx_TraceLine(193,0,__PYX_ERR(0, 193, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_xp, 0, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 193, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_xn, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 193, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_cdiv2d(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 193, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dxp_dxn = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
+194:     dxp_dyn = cdiv2d(du2d(xp, axis=1), du2d(yn, axis=1))
  __Pyx_TraceLine(194,0,__PYX_ERR(0, 194, __pyx_L1_error))
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_xp, 1, 0, NULL); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 194, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_yn, 1, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 194, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv2d(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 194, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dxp_dyn = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 195: 
+196:     dyp_dxn = cdiv2d(du2d(yp, axis=0), du2d(xn, axis=0))
  __Pyx_TraceLine(196,0,__PYX_ERR(0, 196, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_yp, 0, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 196, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_xn, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 196, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_cdiv2d(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 196, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dyp_dxn = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
+197:     dyp_dyn = cdiv2d(du2d(yp, axis=1), du2d(yn, axis=1))
  __Pyx_TraceLine(197,0,__PYX_ERR(0, 197, __pyx_L1_error))
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_yp, 1, 0, NULL); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 197, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du2d(__pyx_v_yn, 1, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 197, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv2d(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 197, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dyp_dyn = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 198: 
+199:     for ix in range(nx):
  __Pyx_TraceLine(199,0,__PYX_ERR(0, 199, __pyx_L1_error))
  __pyx_t_9 = __pyx_v_nx;
  __pyx_t_10 = __pyx_t_9;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_ix = __pyx_t_11;
+200:         for iy in range(ny):
    __Pyx_TraceLine(200,0,__PYX_ERR(0, 200, __pyx_L1_error))
    __pyx_t_12 = __pyx_v_ny;
    __pyx_t_13 = __pyx_t_12;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_iy = __pyx_t_14;
+201:             J[ix, iy] = 1. / (dxp_dxn[ix, iy] * dyp_dyn[ix, iy] -
      __Pyx_TraceLine(201,0,__PYX_ERR(0, 201, __pyx_L1_error))
      __pyx_t_15 = __pyx_v_ix;
      __pyx_t_16 = __pyx_v_iy;
      __pyx_t_17 = __pyx_v_ix;
      __pyx_t_18 = __pyx_v_iy;
/* … */
      __Pyx_TraceLine(201,0,__PYX_ERR(0, 201, __pyx_L1_error))
      __pyx_t_23 = __pyx_v_ix;
      __pyx_t_24 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_J.data + __pyx_t_23 * __pyx_v_J.strides[0]) )) + __pyx_t_24)) )) = (1. / (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dxp_dxn.data + __pyx_t_15 * __pyx_v_dxp_dxn.strides[0]) )) + __pyx_t_16)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dyp_dyn.data + __pyx_t_17 * __pyx_v_dyp_dyn.strides[0]) )) + __pyx_t_18)) )))) - ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dxp_dyn.data + __pyx_t_19 * __pyx_v_dxp_dyn.strides[0]) )) + __pyx_t_20)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dyp_dxn.data + __pyx_t_21 * __pyx_v_dyp_dxn.strides[0]) )) + __pyx_t_22)) ))))));
    }
  }
+202:                                 dxp_dyn[ix, iy] * dyp_dxn[ix, iy])
      __Pyx_TraceLine(202,0,__PYX_ERR(0, 202, __pyx_L1_error))
      __pyx_t_19 = __pyx_v_ix;
      __pyx_t_20 = __pyx_v_iy;
      __pyx_t_21 = __pyx_v_ix;
      __pyx_t_22 = __pyx_v_iy;
 203: 
 204:     # Jacobian matrix
+205:     for ix in range(nx):
  __Pyx_TraceLine(205,0,__PYX_ERR(0, 205, __pyx_L1_error))
  __pyx_t_9 = __pyx_v_nx;
  __pyx_t_10 = __pyx_t_9;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_ix = __pyx_t_11;
+206:         for iy in range(ny):
    __Pyx_TraceLine(206,0,__PYX_ERR(0, 206, __pyx_L1_error))
    __pyx_t_12 = __pyx_v_ny;
    __pyx_t_13 = __pyx_t_12;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_iy = __pyx_t_14;
+207:             dxn_dxp[ix, iy] = J[ix, iy] * dyp_dyn[ix, iy]
      __Pyx_TraceLine(207,0,__PYX_ERR(0, 207, __pyx_L1_error))
      __pyx_t_22 = __pyx_v_ix;
      __pyx_t_21 = __pyx_v_iy;
      __pyx_t_20 = __pyx_v_ix;
      __pyx_t_19 = __pyx_v_iy;
      __pyx_t_18 = __pyx_v_ix;
      __pyx_t_17 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dxn_dxp.data + __pyx_t_18 * __pyx_v_dxn_dxp.strides[0]) )) + __pyx_t_17)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_J.data + __pyx_t_22 * __pyx_v_J.strides[0]) )) + __pyx_t_21)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dyp_dyn.data + __pyx_t_20 * __pyx_v_dyp_dyn.strides[0]) )) + __pyx_t_19)) ))));
+208:             dxn_dyp[ix, iy] = -J[ix, iy] * dxp_dyn[ix, iy]
      __Pyx_TraceLine(208,0,__PYX_ERR(0, 208, __pyx_L1_error))
      __pyx_t_19 = __pyx_v_ix;
      __pyx_t_20 = __pyx_v_iy;
      __pyx_t_21 = __pyx_v_ix;
      __pyx_t_22 = __pyx_v_iy;
      __pyx_t_17 = __pyx_v_ix;
      __pyx_t_18 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dxn_dyp.data + __pyx_t_17 * __pyx_v_dxn_dyp.strides[0]) )) + __pyx_t_18)) )) = ((-(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_J.data + __pyx_t_19 * __pyx_v_J.strides[0]) )) + __pyx_t_20)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dxp_dyn.data + __pyx_t_21 * __pyx_v_dxp_dyn.strides[0]) )) + __pyx_t_22)) ))));
 209: 
+210:             dyn_dxp[ix, iy] = -J[ix, iy] * dyp_dxn[ix, iy]
      __Pyx_TraceLine(210,0,__PYX_ERR(0, 210, __pyx_L1_error))
      __pyx_t_22 = __pyx_v_ix;
      __pyx_t_21 = __pyx_v_iy;
      __pyx_t_20 = __pyx_v_ix;
      __pyx_t_19 = __pyx_v_iy;
      __pyx_t_18 = __pyx_v_ix;
      __pyx_t_17 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dyn_dxp.data + __pyx_t_18 * __pyx_v_dyn_dxp.strides[0]) )) + __pyx_t_17)) )) = ((-(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_J.data + __pyx_t_22 * __pyx_v_J.strides[0]) )) + __pyx_t_21)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dyp_dxn.data + __pyx_t_20 * __pyx_v_dyp_dxn.strides[0]) )) + __pyx_t_19)) ))));
+211:             dyn_dyp[ix, iy] = J[ix, iy] * dxp_dxn[ix, iy]
      __Pyx_TraceLine(211,0,__PYX_ERR(0, 211, __pyx_L1_error))
      __pyx_t_19 = __pyx_v_ix;
      __pyx_t_20 = __pyx_v_iy;
      __pyx_t_21 = __pyx_v_ix;
      __pyx_t_22 = __pyx_v_iy;
      __pyx_t_17 = __pyx_v_ix;
      __pyx_t_18 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dyn_dyp.data + __pyx_t_17 * __pyx_v_dyn_dyp.strides[0]) )) + __pyx_t_18)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_J.data + __pyx_t_19 * __pyx_v_J.strides[0]) )) + __pyx_t_20)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dxp_dxn.data + __pyx_t_21 * __pyx_v_dxp_dxn.strides[0]) )) + __pyx_t_22)) ))));
    }
  }
 212: 
+213:     return J, dxn_dxp, dxn_dyp, dyn_dxp, dyn_dyp
  __Pyx_TraceLine(213,0,__PYX_ERR(0, 213, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_J, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dxn_dxp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dxn_dyp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_dyn_dxp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_25 = __pyx_memoryview_fromslice(__pyx_v_dyn_dyp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __pyx_t_26 = PyTuple_New(5); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_26);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_26, 3, __pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_25);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_26, 4, __pyx_t_25)) __PYX_ERR(0, 213, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_25 = 0;
  __pyx_r = __pyx_t_26;
  __pyx_t_26 = 0;
  goto __pyx_L0;
 214: 
 215: 
+216: cpdef curvilinear2d_metrics(double[:, ::1] J, double[:, ::1] dxn_dxp, double[:, ::1] dxn_dyp,
static PyObject *__pyx_pw_6libfds_6cmaths_19curvilinear2d_metrics(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_6libfds_6cmaths_curvilinear2d_metrics(__Pyx_memviewslice __pyx_v_J, __Pyx_memviewslice __pyx_v_dxn_dxp, __Pyx_memviewslice __pyx_v_dxn_dyp, __Pyx_memviewslice __pyx_v_dyn_dxp, __Pyx_memviewslice __pyx_v_dyn_dyp, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  __Pyx_memviewslice __pyx_v_invariant_x = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_invariant_y = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_comp_x = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_comp_y = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__21)
  __Pyx_TraceCall("curvilinear2d_metrics", __pyx_f[0], 216, 0, __PYX_ERR(0, 216, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_AddTraceback("libfds.cmaths.curvilinear2d_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_invariant_x, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_invariant_y, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_x, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_y, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_19curvilinear2d_metrics(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_19curvilinear2d_metrics = {"curvilinear2d_metrics", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_19curvilinear2d_metrics, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_19curvilinear2d_metrics(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("curvilinear2d_metrics (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_J,&__pyx_n_s_dxn_dxp,&__pyx_n_s_dxn_dyp,&__pyx_n_s_dyn_dxp,&__pyx_n_s_dyn_dyp,0};
  PyObject* values[5] = {0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_J)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dxn_dxp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear2d_metrics", 1, 5, 5, 1); __PYX_ERR(0, 216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dxn_dyp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear2d_metrics", 1, 5, 5, 2); __PYX_ERR(0, 216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dyn_dxp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear2d_metrics", 1, 5, 5, 3); __PYX_ERR(0, 216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dyn_dyp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear2d_metrics", 1, 5, 5, 4); __PYX_ERR(0, 216, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "curvilinear2d_metrics") < 0)) __PYX_ERR(0, 216, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
    }
    __pyx_v_J = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_J.memview)) __PYX_ERR(0, 216, __pyx_L3_error)
    __pyx_v_dxn_dxp = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dxn_dxp.memview)) __PYX_ERR(0, 216, __pyx_L3_error)
    __pyx_v_dxn_dyp = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dxn_dyp.memview)) __PYX_ERR(0, 216, __pyx_L3_error)
    __pyx_v_dyn_dxp = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dyn_dxp.memview)) __PYX_ERR(0, 217, __pyx_L3_error)
    __pyx_v_dyn_dyp = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dyn_dyp.memview)) __PYX_ERR(0, 217, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("curvilinear2d_metrics", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 216, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dyp, 1);
  __Pyx_AddTraceback("libfds.cmaths.curvilinear2d_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_18curvilinear2d_metrics(__pyx_self, __pyx_v_J, __pyx_v_dxn_dxp, __pyx_v_dxn_dyp, __pyx_v_dyn_dxp, __pyx_v_dyn_dyp);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dyp, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_18curvilinear2d_metrics(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_J, __Pyx_memviewslice __pyx_v_dxn_dxp, __Pyx_memviewslice __pyx_v_dxn_dyp, __Pyx_memviewslice __pyx_v_dyn_dxp, __Pyx_memviewslice __pyx_v_dyn_dyp) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__21)
  __Pyx_TraceCall("curvilinear2d_metrics (wrapper)", __pyx_f[0], 216, 0, __PYX_ERR(0, 216, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_curvilinear2d_metrics(__pyx_v_J, __pyx_v_dxn_dxp, __pyx_v_dxn_dyp, __pyx_v_dyn_dxp, __pyx_v_dyn_dyp, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __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("libfds.cmaths.curvilinear2d_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(216,0,__PYX_ERR(0, 216, __pyx_L1_error))
/* … */
  __pyx_tuple__49 = PyTuple_Pack(5, __pyx_n_s_J, __pyx_n_s_dxn_dxp, __pyx_n_s_dxn_dyp, __pyx_n_s_dyn_dxp, __pyx_n_s_dyn_dyp); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_19curvilinear2d_metrics, 0, __pyx_n_s_curvilinear2d_metrics, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_curvilinear2d_metrics, __pyx_t_7) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_curvilinear2d_metrics, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 216, __pyx_L1_error)
 217:                                               double[:, ::1] dyn_dxp, double[:, ::1] dyn_dyp):
 218: 
+219:     cdef Py_ssize_t nx = dxn_dxp.shape[0]
  __Pyx_TraceLine(219,0,__PYX_ERR(0, 219, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_dxn_dxp.shape[0]);
+220:     cdef Py_ssize_t ny = dyn_dyp.shape[1]
  __Pyx_TraceLine(220,0,__PYX_ERR(0, 220, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_dyn_dyp.shape[1]);
+221:     cdef double[:, ::1] invariant_x = np.empty_like(dxn_dxp)
  __Pyx_TraceLine(221,0,__PYX_ERR(0, 221, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dxn_dxp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_invariant_x = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+222:     cdef double[:, ::1] invariant_y = np.empty_like(dyn_dyp)
  __Pyx_TraceLine(222,0,__PYX_ERR(0, 222, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dyn_dyp, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_invariant_y = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 223:     cdef double[:, ::1] comp_x, comp_y
 224: 
+225:     comp_x = du2d(cdiv2d(dxn_dxp, J), axis=0)
  __Pyx_TraceLine(225,0,__PYX_ERR(0, 225, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv2d(__pyx_v_dxn_dxp, __pyx_v_J); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 225, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du2d(__pyx_t_6, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 225, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __pyx_v_comp_x = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
+226:     comp_y = du2d(cdiv2d(dyn_dxp, J), axis=1)
  __Pyx_TraceLine(226,0,__PYX_ERR(0, 226, __pyx_L1_error))
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_cdiv2d(__pyx_v_dyn_dxp, __pyx_v_J); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 226, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du2d(__pyx_t_7, 1, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 226, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_comp_y = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 227: 
+228:     for ix in range(nx):
  __Pyx_TraceLine(228,0,__PYX_ERR(0, 228, __pyx_L1_error))
  __pyx_t_8 = __pyx_v_nx;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_ix = __pyx_t_10;
+229:         for iy in range(ny):
    __Pyx_TraceLine(229,0,__PYX_ERR(0, 229, __pyx_L1_error))
    __pyx_t_11 = __pyx_v_ny;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_iy = __pyx_t_13;
+230:             invariant_x[ix, iy] = comp_x[ix, iy] + comp_y[ix, iy]
      __Pyx_TraceLine(230,0,__PYX_ERR(0, 230, __pyx_L1_error))
      __pyx_t_14 = __pyx_v_ix;
      __pyx_t_15 = __pyx_v_iy;
      __pyx_t_16 = __pyx_v_ix;
      __pyx_t_17 = __pyx_v_iy;
      __pyx_t_18 = __pyx_v_ix;
      __pyx_t_19 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_invariant_x.data + __pyx_t_18 * __pyx_v_invariant_x.strides[0]) )) + __pyx_t_19)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_comp_x.data + __pyx_t_14 * __pyx_v_comp_x.strides[0]) )) + __pyx_t_15)) ))) + (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_comp_y.data + __pyx_t_16 * __pyx_v_comp_y.strides[0]) )) + __pyx_t_17)) ))));
    }
  }
 231: 
+232:     comp_x = du2d(cdiv2d(dxn_dyp, J), axis=0)
  __Pyx_TraceLine(232,0,__PYX_ERR(0, 232, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv2d(__pyx_v_dxn_dyp, __pyx_v_J); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 232, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du2d(__pyx_t_6, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 232, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_x, 1);
  __pyx_v_comp_x = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
+233:     comp_y = du2d(cdiv2d(dyn_dyp, J), axis=1)
  __Pyx_TraceLine(233,0,__PYX_ERR(0, 233, __pyx_L1_error))
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_cdiv2d(__pyx_v_dyn_dyp, __pyx_v_J); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 233, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du2d(__pyx_t_7, 1, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 233, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_y, 1);
  __pyx_v_comp_y = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 234: 
+235:     for ix in range(nx):
  __Pyx_TraceLine(235,0,__PYX_ERR(0, 235, __pyx_L1_error))
  __pyx_t_8 = __pyx_v_nx;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_ix = __pyx_t_10;
+236:         for iy in range(ny):
    __Pyx_TraceLine(236,0,__PYX_ERR(0, 236, __pyx_L1_error))
    __pyx_t_11 = __pyx_v_ny;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_iy = __pyx_t_13;
+237:             invariant_y[ix, iy] = comp_x[ix, iy] + comp_y[ix, iy]
      __Pyx_TraceLine(237,0,__PYX_ERR(0, 237, __pyx_L1_error))
      __pyx_t_17 = __pyx_v_ix;
      __pyx_t_16 = __pyx_v_iy;
      __pyx_t_15 = __pyx_v_ix;
      __pyx_t_14 = __pyx_v_iy;
      __pyx_t_19 = __pyx_v_ix;
      __pyx_t_18 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_invariant_y.data + __pyx_t_19 * __pyx_v_invariant_y.strides[0]) )) + __pyx_t_18)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_comp_x.data + __pyx_t_17 * __pyx_v_comp_x.strides[0]) )) + __pyx_t_16)) ))) + (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_comp_y.data + __pyx_t_15 * __pyx_v_comp_y.strides[0]) )) + __pyx_t_14)) ))));
    }
  }
 238: 
+239:     return invariant_x, invariant_y
  __Pyx_TraceLine(239,0,__PYX_ERR(0, 239, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_invariant_x, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_invariant_y, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;
 240: 
 241: 
+242: cpdef curvilinear3d_trans(double[:, :, ::1] xp, double[:, :, ::1] yp, double[:, :, ::1] zp,
static PyObject *__pyx_pw_6libfds_6cmaths_21curvilinear3d_trans(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_6libfds_6cmaths_curvilinear3d_trans(__Pyx_memviewslice __pyx_v_xp, __Pyx_memviewslice __pyx_v_yp, __Pyx_memviewslice __pyx_v_zp, __Pyx_memviewslice __pyx_v_xn, __Pyx_memviewslice __pyx_v_yn, __Pyx_memviewslice __pyx_v_zn, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  __Pyx_memviewslice __pyx_v_dxp_dxn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxp_dyn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxp_dzn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyp_dxn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyp_dyn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyp_dzn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzp_dxn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzp_dyn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzp_dzn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dzp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dzp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzn_dzp = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__22)
  __Pyx_TraceCall("curvilinear3d_trans", __pyx_f[0], 242, 0, __PYX_ERR(0, 242, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_XDECREF(__pyx_t_66);
  __Pyx_XDECREF(__pyx_t_67);
  __Pyx_XDECREF(__pyx_t_68);
  __Pyx_XDECREF(__pyx_t_69);
  __Pyx_XDECREF(__pyx_t_70);
  __Pyx_XDECREF(__pyx_t_71);
  __Pyx_XDECREF(__pyx_t_72);
  __Pyx_AddTraceback("libfds.cmaths.curvilinear3d_trans", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxp_dxn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxp_dyn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxp_dzn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyp_dxn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyp_dyn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyp_dzn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzp_dxn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzp_dyn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzp_dzn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dzp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dzp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dzp, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_21curvilinear3d_trans(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_21curvilinear3d_trans = {"curvilinear3d_trans", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_21curvilinear3d_trans, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_21curvilinear3d_trans(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_xp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_yp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_zp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_xn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_yn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_zn = { 0, 0, { 0 }, { 0 }, { 0 } };
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("curvilinear3d_trans (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xp,&__pyx_n_s_yp,&__pyx_n_s_zp,&__pyx_n_s_xn,&__pyx_n_s_yn,&__pyx_n_s_zn,0};
  PyObject* values[6] = {0,0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_yp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_trans", 1, 6, 6, 1); __PYX_ERR(0, 242, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_zp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_trans", 1, 6, 6, 2); __PYX_ERR(0, 242, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xn)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_trans", 1, 6, 6, 3); __PYX_ERR(0, 242, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_yn)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_trans", 1, 6, 6, 4); __PYX_ERR(0, 242, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_zn)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_trans", 1, 6, 6, 5); __PYX_ERR(0, 242, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "curvilinear3d_trans") < 0)) __PYX_ERR(0, 242, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
      values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
    }
    __pyx_v_xp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xp.memview)) __PYX_ERR(0, 242, __pyx_L3_error)
    __pyx_v_yp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_yp.memview)) __PYX_ERR(0, 242, __pyx_L3_error)
    __pyx_v_zp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_zp.memview)) __PYX_ERR(0, 242, __pyx_L3_error)
    __pyx_v_xn = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xn.memview)) __PYX_ERR(0, 243, __pyx_L3_error)
    __pyx_v_yn = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_yn.memview)) __PYX_ERR(0, 243, __pyx_L3_error)
    __pyx_v_zn = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_zn.memview)) __PYX_ERR(0, 243, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("curvilinear3d_trans", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 242, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_xp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_yp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_zp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_xn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_yn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_zn, 1);
  __Pyx_AddTraceback("libfds.cmaths.curvilinear3d_trans", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_20curvilinear3d_trans(__pyx_self, __pyx_v_xp, __pyx_v_yp, __pyx_v_zp, __pyx_v_xn, __pyx_v_yn, __pyx_v_zn);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_xp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_yp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_zp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_xn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_yn, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_zn, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_20curvilinear3d_trans(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xp, __Pyx_memviewslice __pyx_v_yp, __Pyx_memviewslice __pyx_v_zp, __Pyx_memviewslice __pyx_v_xn, __Pyx_memviewslice __pyx_v_yn, __Pyx_memviewslice __pyx_v_zn) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__22)
  __Pyx_TraceCall("curvilinear3d_trans (wrapper)", __pyx_f[0], 242, 0, __PYX_ERR(0, 242, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_curvilinear3d_trans(__pyx_v_xp, __pyx_v_yp, __pyx_v_zp, __pyx_v_xn, __pyx_v_yn, __pyx_v_zn, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __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("libfds.cmaths.curvilinear3d_trans", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(242,0,__PYX_ERR(0, 242, __pyx_L1_error))
/* … */
  __pyx_tuple__50 = PyTuple_Pack(6, __pyx_n_s_xp, __pyx_n_s_yp, __pyx_n_s_zp, __pyx_n_s_xn, __pyx_n_s_yn, __pyx_n_s_zn); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_21curvilinear3d_trans, 0, __pyx_n_s_curvilinear3d_trans, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_curvilinear3d_trans, __pyx_t_7) < 0) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_curvilinear3d_trans, 242, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 242, __pyx_L1_error)
 243:                           double[:, :, ::1] xn, double[:, :, ::1] yn, double[:, :, ::1] zn):
 244: 
+245:     cdef Py_ssize_t nx = xp.shape[0]
  __Pyx_TraceLine(245,0,__PYX_ERR(0, 245, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_xp.shape[0]);
+246:     cdef Py_ssize_t ny = yp.shape[1]
  __Pyx_TraceLine(246,0,__PYX_ERR(0, 246, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_yp.shape[1]);
+247:     cdef Py_ssize_t nz = zp.shape[2]
  __Pyx_TraceLine(247,0,__PYX_ERR(0, 247, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_zp.shape[2]);
 248:     cdef double[:, :, ::1] dxp_dxn, dxp_dyn, dxp_dzn
 249:     cdef double[:, :, ::1] dyp_dxn, dyp_dyn, dyp_dzn
 250:     cdef double[:, :, ::1] dzp_dxn, dzp_dyn, dzp_dzn
+251:     cdef double[:, :, ::1] J = np.empty_like(xp)
  __Pyx_TraceLine(251,0,__PYX_ERR(0, 251, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_J = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+252:     cdef double[:, :, ::1] dxn_dxp = np.empty_like(xp)
  __Pyx_TraceLine(252,0,__PYX_ERR(0, 252, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dxn_dxp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+253:     cdef double[:, :, ::1] dxn_dyp = np.empty_like(xp)
  __Pyx_TraceLine(253,0,__PYX_ERR(0, 253, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dxn_dyp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+254:     cdef double[:, :, ::1] dxn_dzp = np.empty_like(xp)
  __Pyx_TraceLine(254,0,__PYX_ERR(0, 254, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dxn_dzp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+255:     cdef double[:, :, ::1] dyn_dxp = np.empty_like(xp)
  __Pyx_TraceLine(255,0,__PYX_ERR(0, 255, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dyn_dxp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+256:     cdef double[:, :, ::1] dyn_dyp = np.empty_like(xp)
  __Pyx_TraceLine(256,0,__PYX_ERR(0, 256, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dyn_dyp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+257:     cdef double[:, :, ::1] dyn_dzp = np.empty_like(xp)
  __Pyx_TraceLine(257,0,__PYX_ERR(0, 257, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dyn_dzp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+258:     cdef double[:, :, ::1] dzn_dxp = np.empty_like(xp)
  __Pyx_TraceLine(258,0,__PYX_ERR(0, 258, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dzn_dxp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+259:     cdef double[:, :, ::1] dzn_dyp = np.empty_like(xp)
  __Pyx_TraceLine(259,0,__PYX_ERR(0, 259, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dzn_dyp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+260:     cdef double[:, :, ::1] dzn_dzp = np.empty_like(xp)
  __Pyx_TraceLine(260,0,__PYX_ERR(0, 260, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_xp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dzn_dzp = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 261: 
+262:     dxp_dxn = cdiv3d(du3d(xp, axis=0), du3d(xn, axis=0))
  __Pyx_TraceLine(262,0,__PYX_ERR(0, 262, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_xp, 0, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 262, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_xn, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 262, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 262, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dxp_dxn = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
+263:     dxp_dyn = cdiv3d(du3d(xp, axis=1), du3d(yn, axis=1))
  __Pyx_TraceLine(263,0,__PYX_ERR(0, 263, __pyx_L1_error))
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_xp, 1, 0, NULL); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 263, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_yn, 1, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 263, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 263, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dxp_dyn = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+264:     dxp_dzn = cdiv3d(du3d(xp, axis=2), du3d(zn, axis=2))
  __Pyx_TraceLine(264,0,__PYX_ERR(0, 264, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_xp, 2, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 264, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_zn, 2, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 264, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 264, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dxp_dzn = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
 265: 
+266:     dyp_dxn = cdiv3d(du3d(yp, axis=0), du3d(xn, axis=0))
  __Pyx_TraceLine(266,0,__PYX_ERR(0, 266, __pyx_L1_error))
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_yp, 0, 0, NULL); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 266, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_xn, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 266, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 266, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dyp_dxn = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+267:     dyp_dyn = cdiv3d(du3d(yp, axis=1), du3d(yn, axis=1))
  __Pyx_TraceLine(267,0,__PYX_ERR(0, 267, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_yp, 1, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 267, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_yn, 1, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 267, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 267, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dyp_dyn = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
+268:     dyp_dzn = cdiv3d(du3d(yp, axis=2), du3d(zn, axis=2))
  __Pyx_TraceLine(268,0,__PYX_ERR(0, 268, __pyx_L1_error))
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_yp, 2, 0, NULL); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 268, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_zn, 2, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 268, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 268, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dyp_dzn = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 269: 
+270:     dzp_dxn = cdiv3d(du3d(zp, axis=0), du3d(xn, axis=0))
  __Pyx_TraceLine(270,0,__PYX_ERR(0, 270, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_zp, 0, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 270, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_xn, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 270, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 270, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dzp_dxn = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
+271:     dzp_dyn = cdiv3d(du3d(zp, axis=1), du3d(yn, axis=1))
  __Pyx_TraceLine(271,0,__PYX_ERR(0, 271, __pyx_L1_error))
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_zp, 1, 0, NULL); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 271, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_yn, 1, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 271, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 271, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dzp_dyn = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+272:     dzp_dzn = cdiv3d(du3d(zp, axis=2), du3d(zn, axis=2))
  __Pyx_TraceLine(272,0,__PYX_ERR(0, 272, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_zp, 2, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 272, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_v_zn, 2, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 272, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 272, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_dzp_dzn = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
 273: 
+274:     for ix in range(nx):
  __Pyx_TraceLine(274,0,__PYX_ERR(0, 274, __pyx_L1_error))
  __pyx_t_9 = __pyx_v_nx;
  __pyx_t_10 = __pyx_t_9;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_ix = __pyx_t_11;
+275:         for iy in range(ny):
    __Pyx_TraceLine(275,0,__PYX_ERR(0, 275, __pyx_L1_error))
    __pyx_t_12 = __pyx_v_ny;
    __pyx_t_13 = __pyx_t_12;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_iy = __pyx_t_14;
+276:             for iz in range(nz):
      __Pyx_TraceLine(276,0,__PYX_ERR(0, 276, __pyx_L1_error))
      __pyx_t_15 = __pyx_v_nz;
      __pyx_t_16 = __pyx_t_15;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_iz = __pyx_t_17;
+277:                 J[ix, iy, iz] = 1. / (dxp_dxn[ix, iy, iz] * (dyp_dyn[ix, iy, iz] * dzp_dzn[ix, iy, iz] -
        __Pyx_TraceLine(277,0,__PYX_ERR(0, 277, __pyx_L1_error))
        __pyx_t_18 = __pyx_v_ix;
        __pyx_t_19 = __pyx_v_iy;
        __pyx_t_20 = __pyx_v_iz;
        __pyx_t_21 = __pyx_v_ix;
        __pyx_t_22 = __pyx_v_iy;
        __pyx_t_23 = __pyx_v_iz;
        __pyx_t_24 = __pyx_v_ix;
        __pyx_t_25 = __pyx_v_iy;
        __pyx_t_26 = __pyx_v_iz;
/* … */
        __Pyx_TraceLine(277,0,__PYX_ERR(0, 277, __pyx_L1_error))
        __pyx_t_63 = __pyx_v_ix;
        __pyx_t_64 = __pyx_v_iy;
        __pyx_t_65 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_63 * __pyx_v_J.strides[0]) ) + __pyx_t_64 * __pyx_v_J.strides[1]) )) + __pyx_t_65)) )) = (1. / ((((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dxn.data + __pyx_t_18 * __pyx_v_dxp_dxn.strides[0]) ) + __pyx_t_19 * __pyx_v_dxp_dxn.strides[1]) )) + __pyx_t_20)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dyn.data + __pyx_t_21 * __pyx_v_dyp_dyn.strides[0]) ) + __pyx_t_22 * __pyx_v_dyp_dyn.strides[1]) )) + __pyx_t_23)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dzn.data + __pyx_t_24 * __pyx_v_dzp_dzn.strides[0]) ) + __pyx_t_25 * __pyx_v_dzp_dzn.strides[1]) )) + __pyx_t_26)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dzn.data + __pyx_t_27 * __pyx_v_dyp_dzn.strides[0]) ) + __pyx_t_28 * __pyx_v_dyp_dzn.strides[1]) )) + __pyx_t_29)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dyn.data + __pyx_t_30 * __pyx_v_dzp_dyn.strides[0]) ) + __pyx_t_31 * __pyx_v_dzp_dyn.strides[1]) )) + __pyx_t_32)) )))))) + ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dyn.data + __pyx_t_33 * __pyx_v_dxp_dyn.strides[0]) ) + __pyx_t_34 * __pyx_v_dxp_dyn.strides[1]) )) + __pyx_t_35)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dzn.data + __pyx_t_36 * __pyx_v_dyp_dzn.strides[0]) ) + __pyx_t_37 * __pyx_v_dyp_dzn.strides[1]) )) + __pyx_t_38)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dxn.data + __pyx_t_39 * __pyx_v_dzp_dxn.strides[0]) ) + __pyx_t_40 * __pyx_v_dzp_dxn.strides[1]) )) + __pyx_t_41)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dxn.data + __pyx_t_42 * __pyx_v_dyp_dxn.strides[0]) ) + __pyx_t_43 * __pyx_v_dyp_dxn.strides[1]) )) + __pyx_t_44)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dzn.data + __pyx_t_45 * __pyx_v_dzp_dzn.strides[0]) ) + __pyx_t_46 * __pyx_v_dzp_dzn.strides[1]) )) + __pyx_t_47)) ))))))) + ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dzn.data + __pyx_t_48 * __pyx_v_dxp_dzn.strides[0]) ) + __pyx_t_49 * __pyx_v_dxp_dzn.strides[1]) )) + __pyx_t_50)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dxn.data + __pyx_t_51 * __pyx_v_dyp_dxn.strides[0]) ) + __pyx_t_52 * __pyx_v_dyp_dxn.strides[1]) )) + __pyx_t_53)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dyn.data + __pyx_t_54 * __pyx_v_dzp_dyn.strides[0]) ) + __pyx_t_55 * __pyx_v_dzp_dyn.strides[1]) )) + __pyx_t_56)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dyn.data + __pyx_t_57 * __pyx_v_dyp_dyn.strides[0]) ) + __pyx_t_58 * __pyx_v_dyp_dyn.strides[1]) )) + __pyx_t_59)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dxn.data + __pyx_t_60 * __pyx_v_dzp_dxn.strides[0]) ) + __pyx_t_61 * __pyx_v_dzp_dxn.strides[1]) )) + __pyx_t_62)) ))))))));
      }
    }
  }
+278:                                                              dyp_dzn[ix, iy, iz] * dzp_dyn[ix, iy, iz]) +
        __Pyx_TraceLine(278,0,__PYX_ERR(0, 278, __pyx_L1_error))
        __pyx_t_27 = __pyx_v_ix;
        __pyx_t_28 = __pyx_v_iy;
        __pyx_t_29 = __pyx_v_iz;
        __pyx_t_30 = __pyx_v_ix;
        __pyx_t_31 = __pyx_v_iy;
        __pyx_t_32 = __pyx_v_iz;
+279:                                       dxp_dyn[ix, iy, iz] * (dyp_dzn[ix, iy, iz] * dzp_dxn[ix, iy, iz] -
        __Pyx_TraceLine(279,0,__PYX_ERR(0, 279, __pyx_L1_error))
        __pyx_t_33 = __pyx_v_ix;
        __pyx_t_34 = __pyx_v_iy;
        __pyx_t_35 = __pyx_v_iz;
        __pyx_t_36 = __pyx_v_ix;
        __pyx_t_37 = __pyx_v_iy;
        __pyx_t_38 = __pyx_v_iz;
        __pyx_t_39 = __pyx_v_ix;
        __pyx_t_40 = __pyx_v_iy;
        __pyx_t_41 = __pyx_v_iz;
+280:                                                              dyp_dxn[ix, iy, iz] * dzp_dzn[ix, iy, iz]) +
        __Pyx_TraceLine(280,0,__PYX_ERR(0, 280, __pyx_L1_error))
        __pyx_t_42 = __pyx_v_ix;
        __pyx_t_43 = __pyx_v_iy;
        __pyx_t_44 = __pyx_v_iz;
        __pyx_t_45 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_47 = __pyx_v_iz;
+281:                                       dxp_dzn[ix, iy, iz] * (dyp_dxn[ix, iy, iz] * dzp_dyn[ix, iy, iz] -
        __Pyx_TraceLine(281,0,__PYX_ERR(0, 281, __pyx_L1_error))
        __pyx_t_48 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_50 = __pyx_v_iz;
        __pyx_t_51 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_53 = __pyx_v_iz;
        __pyx_t_54 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_56 = __pyx_v_iz;
+282:                                                              dyp_dyn[ix, iy, iz] * dzp_dxn[ix, iy, iz]))
        __Pyx_TraceLine(282,0,__PYX_ERR(0, 282, __pyx_L1_error))
        __pyx_t_57 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_59 = __pyx_v_iz;
        __pyx_t_60 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_62 = __pyx_v_iz;
 283: 
 284:     # Jacobian matrix
+285:     for ix in range(nx):
  __Pyx_TraceLine(285,0,__PYX_ERR(0, 285, __pyx_L1_error))
  __pyx_t_9 = __pyx_v_nx;
  __pyx_t_10 = __pyx_t_9;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
    __pyx_v_ix = __pyx_t_11;
+286:         for iy in range(ny):
    __Pyx_TraceLine(286,0,__PYX_ERR(0, 286, __pyx_L1_error))
    __pyx_t_12 = __pyx_v_ny;
    __pyx_t_13 = __pyx_t_12;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
      __pyx_v_iy = __pyx_t_14;
+287:             for iz in range(nz):
      __Pyx_TraceLine(287,0,__PYX_ERR(0, 287, __pyx_L1_error))
      __pyx_t_15 = __pyx_v_nz;
      __pyx_t_16 = __pyx_t_15;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_iz = __pyx_t_17;
+288:                 dxn_dxp[ix, iy, iz] = J[ix, iy, iz] * (dyp_dyn[ix, iy, iz] * dzp_dzn[ix, iy, iz] - dyp_dzn[ix, iy, iz] * dzp_dyn[ix, iy, iz])
        __Pyx_TraceLine(288,0,__PYX_ERR(0, 288, __pyx_L1_error))
        __pyx_t_62 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_60 = __pyx_v_iz;
        __pyx_t_59 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_57 = __pyx_v_iz;
        __pyx_t_56 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_54 = __pyx_v_iz;
        __pyx_t_53 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_51 = __pyx_v_iz;
        __pyx_t_50 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
        __pyx_t_47 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_45 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxn_dxp.data + __pyx_t_47 * __pyx_v_dxn_dxp.strides[0]) ) + __pyx_t_46 * __pyx_v_dxn_dxp.strides[1]) )) + __pyx_t_45)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_62 * __pyx_v_J.strides[0]) ) + __pyx_t_61 * __pyx_v_J.strides[1]) )) + __pyx_t_60)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dyn.data + __pyx_t_59 * __pyx_v_dyp_dyn.strides[0]) ) + __pyx_t_58 * __pyx_v_dyp_dyn.strides[1]) )) + __pyx_t_57)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dzn.data + __pyx_t_56 * __pyx_v_dzp_dzn.strides[0]) ) + __pyx_t_55 * __pyx_v_dzp_dzn.strides[1]) )) + __pyx_t_54)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dzn.data + __pyx_t_53 * __pyx_v_dyp_dzn.strides[0]) ) + __pyx_t_52 * __pyx_v_dyp_dzn.strides[1]) )) + __pyx_t_51)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dyn.data + __pyx_t_50 * __pyx_v_dzp_dyn.strides[0]) ) + __pyx_t_49 * __pyx_v_dzp_dyn.strides[1]) )) + __pyx_t_48)) ))))));
+289:                 dxn_dyp[ix, iy, iz] = J[ix, iy, iz] * (dzp_dyn[ix, iy, iz] * dxp_dzn[ix, iy, iz] - dzp_dzn[ix, iy, iz] * dxp_dyn[ix, iy, iz])
        __Pyx_TraceLine(289,0,__PYX_ERR(0, 289, __pyx_L1_error))
        __pyx_t_48 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_50 = __pyx_v_iz;
        __pyx_t_51 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_53 = __pyx_v_iz;
        __pyx_t_54 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_56 = __pyx_v_iz;
        __pyx_t_57 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_59 = __pyx_v_iz;
        __pyx_t_60 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_62 = __pyx_v_iz;
        __pyx_t_45 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_47 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxn_dyp.data + __pyx_t_45 * __pyx_v_dxn_dyp.strides[0]) ) + __pyx_t_46 * __pyx_v_dxn_dyp.strides[1]) )) + __pyx_t_47)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_48 * __pyx_v_J.strides[0]) ) + __pyx_t_49 * __pyx_v_J.strides[1]) )) + __pyx_t_50)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dyn.data + __pyx_t_51 * __pyx_v_dzp_dyn.strides[0]) ) + __pyx_t_52 * __pyx_v_dzp_dyn.strides[1]) )) + __pyx_t_53)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dzn.data + __pyx_t_54 * __pyx_v_dxp_dzn.strides[0]) ) + __pyx_t_55 * __pyx_v_dxp_dzn.strides[1]) )) + __pyx_t_56)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dzn.data + __pyx_t_57 * __pyx_v_dzp_dzn.strides[0]) ) + __pyx_t_58 * __pyx_v_dzp_dzn.strides[1]) )) + __pyx_t_59)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dyn.data + __pyx_t_60 * __pyx_v_dxp_dyn.strides[0]) ) + __pyx_t_61 * __pyx_v_dxp_dyn.strides[1]) )) + __pyx_t_62)) ))))));
+290:                 dxn_dzp[ix, iy, iz] = J[ix, iy, iz] * (dxp_dyn[ix, iy, iz] * dyp_dzn[ix, iy, iz] - dxp_dzn[ix, iy, iz] * dyp_dyn[ix, iy, iz])
        __Pyx_TraceLine(290,0,__PYX_ERR(0, 290, __pyx_L1_error))
        __pyx_t_62 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_60 = __pyx_v_iz;
        __pyx_t_59 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_57 = __pyx_v_iz;
        __pyx_t_56 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_54 = __pyx_v_iz;
        __pyx_t_53 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_51 = __pyx_v_iz;
        __pyx_t_50 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
        __pyx_t_47 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_45 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxn_dzp.data + __pyx_t_47 * __pyx_v_dxn_dzp.strides[0]) ) + __pyx_t_46 * __pyx_v_dxn_dzp.strides[1]) )) + __pyx_t_45)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_62 * __pyx_v_J.strides[0]) ) + __pyx_t_61 * __pyx_v_J.strides[1]) )) + __pyx_t_60)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dyn.data + __pyx_t_59 * __pyx_v_dxp_dyn.strides[0]) ) + __pyx_t_58 * __pyx_v_dxp_dyn.strides[1]) )) + __pyx_t_57)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dzn.data + __pyx_t_56 * __pyx_v_dyp_dzn.strides[0]) ) + __pyx_t_55 * __pyx_v_dyp_dzn.strides[1]) )) + __pyx_t_54)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dzn.data + __pyx_t_53 * __pyx_v_dxp_dzn.strides[0]) ) + __pyx_t_52 * __pyx_v_dxp_dzn.strides[1]) )) + __pyx_t_51)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dyn.data + __pyx_t_50 * __pyx_v_dyp_dyn.strides[0]) ) + __pyx_t_49 * __pyx_v_dyp_dyn.strides[1]) )) + __pyx_t_48)) ))))));
 291: 
+292:                 dyn_dxp[ix, iy, iz] = J[ix, iy, iz] * (dyp_dzn[ix, iy, iz] * dzp_dxn[ix, iy, iz] - dyp_dxn[ix, iy, iz] * dzp_dzn[ix, iy, iz])
        __Pyx_TraceLine(292,0,__PYX_ERR(0, 292, __pyx_L1_error))
        __pyx_t_48 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_50 = __pyx_v_iz;
        __pyx_t_51 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_53 = __pyx_v_iz;
        __pyx_t_54 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_56 = __pyx_v_iz;
        __pyx_t_57 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_59 = __pyx_v_iz;
        __pyx_t_60 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_62 = __pyx_v_iz;
        __pyx_t_45 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_47 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyn_dxp.data + __pyx_t_45 * __pyx_v_dyn_dxp.strides[0]) ) + __pyx_t_46 * __pyx_v_dyn_dxp.strides[1]) )) + __pyx_t_47)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_48 * __pyx_v_J.strides[0]) ) + __pyx_t_49 * __pyx_v_J.strides[1]) )) + __pyx_t_50)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dzn.data + __pyx_t_51 * __pyx_v_dyp_dzn.strides[0]) ) + __pyx_t_52 * __pyx_v_dyp_dzn.strides[1]) )) + __pyx_t_53)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dxn.data + __pyx_t_54 * __pyx_v_dzp_dxn.strides[0]) ) + __pyx_t_55 * __pyx_v_dzp_dxn.strides[1]) )) + __pyx_t_56)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dxn.data + __pyx_t_57 * __pyx_v_dyp_dxn.strides[0]) ) + __pyx_t_58 * __pyx_v_dyp_dxn.strides[1]) )) + __pyx_t_59)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dzn.data + __pyx_t_60 * __pyx_v_dzp_dzn.strides[0]) ) + __pyx_t_61 * __pyx_v_dzp_dzn.strides[1]) )) + __pyx_t_62)) ))))));
+293:                 dyn_dyp[ix, iy, iz] = J[ix, iy, iz] * (dzp_dzn[ix, iy, iz] * dxp_dxn[ix, iy, iz] - dzp_dxn[ix, iy, iz] * dxp_dzn[ix, iy, iz])
        __Pyx_TraceLine(293,0,__PYX_ERR(0, 293, __pyx_L1_error))
        __pyx_t_62 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_60 = __pyx_v_iz;
        __pyx_t_59 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_57 = __pyx_v_iz;
        __pyx_t_56 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_54 = __pyx_v_iz;
        __pyx_t_53 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_51 = __pyx_v_iz;
        __pyx_t_50 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
        __pyx_t_47 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_45 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyn_dyp.data + __pyx_t_47 * __pyx_v_dyn_dyp.strides[0]) ) + __pyx_t_46 * __pyx_v_dyn_dyp.strides[1]) )) + __pyx_t_45)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_62 * __pyx_v_J.strides[0]) ) + __pyx_t_61 * __pyx_v_J.strides[1]) )) + __pyx_t_60)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dzn.data + __pyx_t_59 * __pyx_v_dzp_dzn.strides[0]) ) + __pyx_t_58 * __pyx_v_dzp_dzn.strides[1]) )) + __pyx_t_57)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dxn.data + __pyx_t_56 * __pyx_v_dxp_dxn.strides[0]) ) + __pyx_t_55 * __pyx_v_dxp_dxn.strides[1]) )) + __pyx_t_54)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dxn.data + __pyx_t_53 * __pyx_v_dzp_dxn.strides[0]) ) + __pyx_t_52 * __pyx_v_dzp_dxn.strides[1]) )) + __pyx_t_51)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dzn.data + __pyx_t_50 * __pyx_v_dxp_dzn.strides[0]) ) + __pyx_t_49 * __pyx_v_dxp_dzn.strides[1]) )) + __pyx_t_48)) ))))));
+294:                 dyn_dzp[ix, iy, iz] = J[ix, iy, iz] * (dxp_dzn[ix, iy, iz] * dyp_dxn[ix, iy, iz] - dxp_dxn[ix, iy, iz] * dyp_dzn[ix, iy, iz])
        __Pyx_TraceLine(294,0,__PYX_ERR(0, 294, __pyx_L1_error))
        __pyx_t_48 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_50 = __pyx_v_iz;
        __pyx_t_51 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_53 = __pyx_v_iz;
        __pyx_t_54 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_56 = __pyx_v_iz;
        __pyx_t_57 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_59 = __pyx_v_iz;
        __pyx_t_60 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_62 = __pyx_v_iz;
        __pyx_t_45 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_47 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyn_dzp.data + __pyx_t_45 * __pyx_v_dyn_dzp.strides[0]) ) + __pyx_t_46 * __pyx_v_dyn_dzp.strides[1]) )) + __pyx_t_47)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_48 * __pyx_v_J.strides[0]) ) + __pyx_t_49 * __pyx_v_J.strides[1]) )) + __pyx_t_50)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dzn.data + __pyx_t_51 * __pyx_v_dxp_dzn.strides[0]) ) + __pyx_t_52 * __pyx_v_dxp_dzn.strides[1]) )) + __pyx_t_53)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dxn.data + __pyx_t_54 * __pyx_v_dyp_dxn.strides[0]) ) + __pyx_t_55 * __pyx_v_dyp_dxn.strides[1]) )) + __pyx_t_56)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dxn.data + __pyx_t_57 * __pyx_v_dxp_dxn.strides[0]) ) + __pyx_t_58 * __pyx_v_dxp_dxn.strides[1]) )) + __pyx_t_59)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dzn.data + __pyx_t_60 * __pyx_v_dyp_dzn.strides[0]) ) + __pyx_t_61 * __pyx_v_dyp_dzn.strides[1]) )) + __pyx_t_62)) ))))));
 295: 
+296:                 dzn_dxp[ix, iy, iz] = J[ix, iy, iz] * (dyp_dxn[ix, iy, iz] * dzp_dyn[ix, iy, iz] - dyp_dyn[ix, iy, iz] * dzp_dxn[ix, iy, iz])
        __Pyx_TraceLine(296,0,__PYX_ERR(0, 296, __pyx_L1_error))
        __pyx_t_62 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_60 = __pyx_v_iz;
        __pyx_t_59 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_57 = __pyx_v_iz;
        __pyx_t_56 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_54 = __pyx_v_iz;
        __pyx_t_53 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_51 = __pyx_v_iz;
        __pyx_t_50 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
        __pyx_t_47 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_45 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzn_dxp.data + __pyx_t_47 * __pyx_v_dzn_dxp.strides[0]) ) + __pyx_t_46 * __pyx_v_dzn_dxp.strides[1]) )) + __pyx_t_45)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_62 * __pyx_v_J.strides[0]) ) + __pyx_t_61 * __pyx_v_J.strides[1]) )) + __pyx_t_60)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dxn.data + __pyx_t_59 * __pyx_v_dyp_dxn.strides[0]) ) + __pyx_t_58 * __pyx_v_dyp_dxn.strides[1]) )) + __pyx_t_57)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dyn.data + __pyx_t_56 * __pyx_v_dzp_dyn.strides[0]) ) + __pyx_t_55 * __pyx_v_dzp_dyn.strides[1]) )) + __pyx_t_54)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dyn.data + __pyx_t_53 * __pyx_v_dyp_dyn.strides[0]) ) + __pyx_t_52 * __pyx_v_dyp_dyn.strides[1]) )) + __pyx_t_51)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dxn.data + __pyx_t_50 * __pyx_v_dzp_dxn.strides[0]) ) + __pyx_t_49 * __pyx_v_dzp_dxn.strides[1]) )) + __pyx_t_48)) ))))));
+297:                 dzn_dyp[ix, iy, iz] = J[ix, iy, iz] * (dzp_dxn[ix, iy, iz] * dxp_dyn[ix, iy, iz] - dzp_dyn[ix, iy, iz] * dxp_dxn[ix, iy, iz])
        __Pyx_TraceLine(297,0,__PYX_ERR(0, 297, __pyx_L1_error))
        __pyx_t_48 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_50 = __pyx_v_iz;
        __pyx_t_51 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_53 = __pyx_v_iz;
        __pyx_t_54 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_56 = __pyx_v_iz;
        __pyx_t_57 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_59 = __pyx_v_iz;
        __pyx_t_60 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_62 = __pyx_v_iz;
        __pyx_t_45 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_47 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzn_dyp.data + __pyx_t_45 * __pyx_v_dzn_dyp.strides[0]) ) + __pyx_t_46 * __pyx_v_dzn_dyp.strides[1]) )) + __pyx_t_47)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_48 * __pyx_v_J.strides[0]) ) + __pyx_t_49 * __pyx_v_J.strides[1]) )) + __pyx_t_50)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dxn.data + __pyx_t_51 * __pyx_v_dzp_dxn.strides[0]) ) + __pyx_t_52 * __pyx_v_dzp_dxn.strides[1]) )) + __pyx_t_53)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dyn.data + __pyx_t_54 * __pyx_v_dxp_dyn.strides[0]) ) + __pyx_t_55 * __pyx_v_dxp_dyn.strides[1]) )) + __pyx_t_56)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzp_dyn.data + __pyx_t_57 * __pyx_v_dzp_dyn.strides[0]) ) + __pyx_t_58 * __pyx_v_dzp_dyn.strides[1]) )) + __pyx_t_59)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dxn.data + __pyx_t_60 * __pyx_v_dxp_dxn.strides[0]) ) + __pyx_t_61 * __pyx_v_dxp_dxn.strides[1]) )) + __pyx_t_62)) ))))));
+298:                 dzn_dzp[ix, iy, iz] = J[ix, iy, iz] * (dxp_dxn[ix, iy, iz] * dyp_dyn[ix, iy, iz] - dxp_dyn[ix, iy, iz] * dyp_dxn[ix, iy, iz])
        __Pyx_TraceLine(298,0,__PYX_ERR(0, 298, __pyx_L1_error))
        __pyx_t_62 = __pyx_v_ix;
        __pyx_t_61 = __pyx_v_iy;
        __pyx_t_60 = __pyx_v_iz;
        __pyx_t_59 = __pyx_v_ix;
        __pyx_t_58 = __pyx_v_iy;
        __pyx_t_57 = __pyx_v_iz;
        __pyx_t_56 = __pyx_v_ix;
        __pyx_t_55 = __pyx_v_iy;
        __pyx_t_54 = __pyx_v_iz;
        __pyx_t_53 = __pyx_v_ix;
        __pyx_t_52 = __pyx_v_iy;
        __pyx_t_51 = __pyx_v_iz;
        __pyx_t_50 = __pyx_v_ix;
        __pyx_t_49 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
        __pyx_t_47 = __pyx_v_ix;
        __pyx_t_46 = __pyx_v_iy;
        __pyx_t_45 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dzn_dzp.data + __pyx_t_47 * __pyx_v_dzn_dzp.strides[0]) ) + __pyx_t_46 * __pyx_v_dzn_dzp.strides[1]) )) + __pyx_t_45)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_J.data + __pyx_t_62 * __pyx_v_J.strides[0]) ) + __pyx_t_61 * __pyx_v_J.strides[1]) )) + __pyx_t_60)) ))) * (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dxn.data + __pyx_t_59 * __pyx_v_dxp_dxn.strides[0]) ) + __pyx_t_58 * __pyx_v_dxp_dxn.strides[1]) )) + __pyx_t_57)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dyn.data + __pyx_t_56 * __pyx_v_dyp_dyn.strides[0]) ) + __pyx_t_55 * __pyx_v_dyp_dyn.strides[1]) )) + __pyx_t_54)) )))) - ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dxp_dyn.data + __pyx_t_53 * __pyx_v_dxp_dyn.strides[0]) ) + __pyx_t_52 * __pyx_v_dxp_dyn.strides[1]) )) + __pyx_t_51)) ))) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dyp_dxn.data + __pyx_t_50 * __pyx_v_dyp_dxn.strides[0]) ) + __pyx_t_49 * __pyx_v_dyp_dxn.strides[1]) )) + __pyx_t_48)) ))))));
      }
    }
  }
 299: 
+300:     return J, dxn_dxp, dxn_dyp, dxn_dzp, dyn_dxp, dyn_dyp, dyn_dzp, dzn_dxp, dzn_dyp, dzn_dzp
  __Pyx_TraceLine(300,0,__PYX_ERR(0, 300, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_J, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dxn_dxp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dxn_dyp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_dxn_dzp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_66 = __pyx_memoryview_fromslice(__pyx_v_dyn_dxp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_66);
  __pyx_t_67 = __pyx_memoryview_fromslice(__pyx_v_dyn_dyp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_67)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_67);
  __pyx_t_68 = __pyx_memoryview_fromslice(__pyx_v_dyn_dzp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_68)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_68);
  __pyx_t_69 = __pyx_memoryview_fromslice(__pyx_v_dzn_dxp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_69);
  __pyx_t_70 = __pyx_memoryview_fromslice(__pyx_v_dzn_dyp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_70)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_70);
  __pyx_t_71 = __pyx_memoryview_fromslice(__pyx_v_dzn_dzp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_71)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_71);
  __pyx_t_72 = PyTuple_New(10); if (unlikely(!__pyx_t_72)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_72);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 0, __pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 1, __pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 2, __pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 3, __pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_66);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 4, __pyx_t_66)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_67);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 5, __pyx_t_67)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_68);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 6, __pyx_t_68)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_69);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 7, __pyx_t_69)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_70);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 8, __pyx_t_70)) __PYX_ERR(0, 300, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_71);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_72, 9, __pyx_t_71)) __PYX_ERR(0, 300, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_66 = 0;
  __pyx_t_67 = 0;
  __pyx_t_68 = 0;
  __pyx_t_69 = 0;
  __pyx_t_70 = 0;
  __pyx_t_71 = 0;
  __pyx_r = __pyx_t_72;
  __pyx_t_72 = 0;
  goto __pyx_L0;
 301: 
 302: 
+303: cpdef curvilinear3d_metrics(double[:, :, ::1] J, double[:, :, ::1] dxn_dxp, double[:, :, ::1] dxn_dyp, double[:, :, ::1] dxn_dzp,
static PyObject *__pyx_pw_6libfds_6cmaths_23curvilinear3d_metrics(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_6libfds_6cmaths_curvilinear3d_metrics(__Pyx_memviewslice __pyx_v_J, __Pyx_memviewslice __pyx_v_dxn_dxp, __Pyx_memviewslice __pyx_v_dxn_dyp, __Pyx_memviewslice __pyx_v_dxn_dzp, __Pyx_memviewslice __pyx_v_dyn_dxp, __Pyx_memviewslice __pyx_v_dyn_dyp, __Pyx_memviewslice __pyx_v_dyn_dzp, __Pyx_memviewslice __pyx_v_dzn_dxp, __Pyx_memviewslice __pyx_v_dzn_dyp, __Pyx_memviewslice __pyx_v_dzn_dzp, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  __Pyx_memviewslice __pyx_v_invariant_x = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_invariant_y = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_invariant_z = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_comp_x = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_comp_y = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_comp_z = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__23)
  __Pyx_TraceCall("curvilinear3d_metrics", __pyx_f[0], 303, 0, __PYX_ERR(0, 303, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_AddTraceback("libfds.cmaths.curvilinear3d_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_invariant_x, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_invariant_y, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_invariant_z, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_x, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_y, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_z, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_23curvilinear3d_metrics(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_23curvilinear3d_metrics = {"curvilinear3d_metrics", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_23curvilinear3d_metrics, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_23curvilinear3d_metrics(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dxn_dzp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dyn_dzp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzn_dxp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzn_dyp = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dzn_dzp = { 0, 0, { 0 }, { 0 }, { 0 } };
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("curvilinear3d_metrics (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_J,&__pyx_n_s_dxn_dxp,&__pyx_n_s_dxn_dyp,&__pyx_n_s_dxn_dzp,&__pyx_n_s_dyn_dxp,&__pyx_n_s_dyn_dyp,&__pyx_n_s_dyn_dzp,&__pyx_n_s_dzn_dxp,&__pyx_n_s_dzn_dyp,&__pyx_n_s_dzn_dzp,0};
  PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_J)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dxn_dxp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 1); __PYX_ERR(0, 303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dxn_dyp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 2); __PYX_ERR(0, 303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dxn_dzp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 3); __PYX_ERR(0, 303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dyn_dxp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 4); __PYX_ERR(0, 303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dyn_dyp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 5); __PYX_ERR(0, 303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dyn_dzp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[6]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 6); __PYX_ERR(0, 303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dzn_dxp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[7]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 7); __PYX_ERR(0, 303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dzn_dyp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[8]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 8); __PYX_ERR(0, 303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dzn_dzp)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[9]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, 9); __PYX_ERR(0, 303, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "curvilinear3d_metrics") < 0)) __PYX_ERR(0, 303, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 10)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
      values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
      values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
      values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
      values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
      values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9);
    }
    __pyx_v_J = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_J.memview)) __PYX_ERR(0, 303, __pyx_L3_error)
    __pyx_v_dxn_dxp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dxn_dxp.memview)) __PYX_ERR(0, 303, __pyx_L3_error)
    __pyx_v_dxn_dyp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dxn_dyp.memview)) __PYX_ERR(0, 303, __pyx_L3_error)
    __pyx_v_dxn_dzp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dxn_dzp.memview)) __PYX_ERR(0, 303, __pyx_L3_error)
    __pyx_v_dyn_dxp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dyn_dxp.memview)) __PYX_ERR(0, 304, __pyx_L3_error)
    __pyx_v_dyn_dyp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dyn_dyp.memview)) __PYX_ERR(0, 304, __pyx_L3_error)
    __pyx_v_dyn_dzp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dyn_dzp.memview)) __PYX_ERR(0, 304, __pyx_L3_error)
    __pyx_v_dzn_dxp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dzn_dxp.memview)) __PYX_ERR(0, 305, __pyx_L3_error)
    __pyx_v_dzn_dyp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dzn_dyp.memview)) __PYX_ERR(0, 305, __pyx_L3_error)
    __pyx_v_dzn_dzp = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[9], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dzn_dzp.memview)) __PYX_ERR(0, 305, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("curvilinear3d_metrics", 1, 10, 10, __pyx_nargs); __PYX_ERR(0, 303, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dzp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dzp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dzp, 1);
  __Pyx_AddTraceback("libfds.cmaths.curvilinear3d_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_22curvilinear3d_metrics(__pyx_self, __pyx_v_J, __pyx_v_dxn_dxp, __pyx_v_dxn_dyp, __pyx_v_dxn_dzp, __pyx_v_dyn_dxp, __pyx_v_dyn_dyp, __pyx_v_dyn_dzp, __pyx_v_dzn_dxp, __pyx_v_dzn_dyp, __pyx_v_dzn_dzp);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_J, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dxn_dzp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dyn_dzp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dxp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dyp, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dzn_dzp, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_22curvilinear3d_metrics(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_J, __Pyx_memviewslice __pyx_v_dxn_dxp, __Pyx_memviewslice __pyx_v_dxn_dyp, __Pyx_memviewslice __pyx_v_dxn_dzp, __Pyx_memviewslice __pyx_v_dyn_dxp, __Pyx_memviewslice __pyx_v_dyn_dyp, __Pyx_memviewslice __pyx_v_dyn_dzp, __Pyx_memviewslice __pyx_v_dzn_dxp, __Pyx_memviewslice __pyx_v_dzn_dyp, __Pyx_memviewslice __pyx_v_dzn_dzp) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__23)
  __Pyx_TraceCall("curvilinear3d_metrics (wrapper)", __pyx_f[0], 303, 0, __PYX_ERR(0, 303, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_curvilinear3d_metrics(__pyx_v_J, __pyx_v_dxn_dxp, __pyx_v_dxn_dyp, __pyx_v_dxn_dzp, __pyx_v_dyn_dxp, __pyx_v_dyn_dyp, __pyx_v_dyn_dzp, __pyx_v_dzn_dxp, __pyx_v_dzn_dyp, __pyx_v_dzn_dzp, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __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("libfds.cmaths.curvilinear3d_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(303,0,__PYX_ERR(0, 303, __pyx_L1_error))
/* … */
  __pyx_tuple__51 = PyTuple_Pack(10, __pyx_n_s_J, __pyx_n_s_dxn_dxp, __pyx_n_s_dxn_dyp, __pyx_n_s_dxn_dzp, __pyx_n_s_dyn_dxp, __pyx_n_s_dyn_dyp, __pyx_n_s_dyn_dzp, __pyx_n_s_dzn_dxp, __pyx_n_s_dzn_dyp, __pyx_n_s_dzn_dzp); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_23curvilinear3d_metrics, 0, __pyx_n_s_curvilinear3d_metrics, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_curvilinear3d_metrics, __pyx_t_7) < 0) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_curvilinear3d_metrics, 303, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 303, __pyx_L1_error)
 304:                                                  double[:, :, ::1] dyn_dxp, double[:, :, ::1] dyn_dyp, double[:, :, ::1] dyn_dzp,
 305:                                                  double[:, :, ::1] dzn_dxp, double[:, :, ::1] dzn_dyp, double[:, :, ::1] dzn_dzp):
 306: 
+307:     cdef Py_ssize_t nx = dxn_dxp.shape[0]
  __Pyx_TraceLine(307,0,__PYX_ERR(0, 307, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_dxn_dxp.shape[0]);
+308:     cdef Py_ssize_t ny = dyn_dyp.shape[1]
  __Pyx_TraceLine(308,0,__PYX_ERR(0, 308, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_dyn_dyp.shape[1]);
+309:     cdef Py_ssize_t nz = dzn_dzp.shape[2]
  __Pyx_TraceLine(309,0,__PYX_ERR(0, 309, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_dzn_dzp.shape[2]);
+310:     cdef double[:, :, ::1] invariant_x = np.empty_like(dxn_dxp)
  __Pyx_TraceLine(310,0,__PYX_ERR(0, 310, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dxn_dxp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_invariant_x = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+311:     cdef double[:, :, ::1] invariant_y = np.empty_like(dyn_dyp)
  __Pyx_TraceLine(311,0,__PYX_ERR(0, 311, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dyn_dyp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_invariant_y = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+312:     cdef double[:, :, ::1] invariant_z = np.empty_like(dzn_dzp)
  __Pyx_TraceLine(312,0,__PYX_ERR(0, 312, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dzn_dzp, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_invariant_z = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 313:     cdef double[:, :, ::1] comp_x, comp_y, comp_z
 314: 
+315:     comp_x = du3d(cdiv3d(dxn_dxp, J), axis=0)
  __Pyx_TraceLine(315,0,__PYX_ERR(0, 315, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dxn_dxp, __pyx_v_J); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 315, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_6, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 315, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __pyx_v_comp_x = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
+316:     comp_y = du3d(cdiv3d(dyn_dxp, J), axis=1)
  __Pyx_TraceLine(316,0,__PYX_ERR(0, 316, __pyx_L1_error))
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dyn_dxp, __pyx_v_J); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 316, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_7, 1, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 316, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_v_comp_y = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+317:     comp_z = du3d(cdiv3d(dzn_dxp, J), axis=2)
  __Pyx_TraceLine(317,0,__PYX_ERR(0, 317, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dzn_dxp, __pyx_v_J); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 317, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_6, 2, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 317, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __pyx_v_comp_z = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
 318: 
+319:     for ix in range(nx):
  __Pyx_TraceLine(319,0,__PYX_ERR(0, 319, __pyx_L1_error))
  __pyx_t_8 = __pyx_v_nx;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_ix = __pyx_t_10;
+320:         for iy in range(ny):
    __Pyx_TraceLine(320,0,__PYX_ERR(0, 320, __pyx_L1_error))
    __pyx_t_11 = __pyx_v_ny;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_iy = __pyx_t_13;
+321:             for iz in range(nz):
      __Pyx_TraceLine(321,0,__PYX_ERR(0, 321, __pyx_L1_error))
      __pyx_t_14 = __pyx_v_nz;
      __pyx_t_15 = __pyx_t_14;
      for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
        __pyx_v_iz = __pyx_t_16;
+322:                 invariant_x[ix, iy, iz] = comp_x[ix, iy, iz] + comp_y[ix, iy, iz] + comp_z[ix, iy, iz]
        __Pyx_TraceLine(322,0,__PYX_ERR(0, 322, __pyx_L1_error))
        __pyx_t_17 = __pyx_v_ix;
        __pyx_t_18 = __pyx_v_iy;
        __pyx_t_19 = __pyx_v_iz;
        __pyx_t_20 = __pyx_v_ix;
        __pyx_t_21 = __pyx_v_iy;
        __pyx_t_22 = __pyx_v_iz;
        __pyx_t_23 = __pyx_v_ix;
        __pyx_t_24 = __pyx_v_iy;
        __pyx_t_25 = __pyx_v_iz;
        __pyx_t_26 = __pyx_v_ix;
        __pyx_t_27 = __pyx_v_iy;
        __pyx_t_28 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_invariant_x.data + __pyx_t_26 * __pyx_v_invariant_x.strides[0]) ) + __pyx_t_27 * __pyx_v_invariant_x.strides[1]) )) + __pyx_t_28)) )) = (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_x.data + __pyx_t_17 * __pyx_v_comp_x.strides[0]) ) + __pyx_t_18 * __pyx_v_comp_x.strides[1]) )) + __pyx_t_19)) ))) + (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_y.data + __pyx_t_20 * __pyx_v_comp_y.strides[0]) ) + __pyx_t_21 * __pyx_v_comp_y.strides[1]) )) + __pyx_t_22)) )))) + (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_z.data + __pyx_t_23 * __pyx_v_comp_z.strides[0]) ) + __pyx_t_24 * __pyx_v_comp_z.strides[1]) )) + __pyx_t_25)) ))));
      }
    }
  }
 323: 
+324:     comp_x = du3d(cdiv3d(dxn_dyp, J), axis=0)
  __Pyx_TraceLine(324,0,__PYX_ERR(0, 324, __pyx_L1_error))
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dxn_dyp, __pyx_v_J); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 324, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_7, 0, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 324, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_x, 1);
  __pyx_v_comp_x = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+325:     comp_y = du3d(cdiv3d(dyn_dyp, J), axis=1)
  __Pyx_TraceLine(325,0,__PYX_ERR(0, 325, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dyn_dyp, __pyx_v_J); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 325, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_6, 1, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 325, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_y, 1);
  __pyx_v_comp_y = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
+326:     comp_z = du3d(cdiv3d(dzn_dyp, J), axis=2)
  __Pyx_TraceLine(326,0,__PYX_ERR(0, 326, __pyx_L1_error))
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dzn_dyp, __pyx_v_J); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 326, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_7, 2, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 326, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_z, 1);
  __pyx_v_comp_z = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 327: 
+328:     for ix in range(nx):
  __Pyx_TraceLine(328,0,__PYX_ERR(0, 328, __pyx_L1_error))
  __pyx_t_8 = __pyx_v_nx;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_ix = __pyx_t_10;
+329:         for iy in range(ny):
    __Pyx_TraceLine(329,0,__PYX_ERR(0, 329, __pyx_L1_error))
    __pyx_t_11 = __pyx_v_ny;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_iy = __pyx_t_13;
+330:             for iz in range(nz):
      __Pyx_TraceLine(330,0,__PYX_ERR(0, 330, __pyx_L1_error))
      __pyx_t_14 = __pyx_v_nz;
      __pyx_t_15 = __pyx_t_14;
      for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
        __pyx_v_iz = __pyx_t_16;
+331:                 invariant_y[ix, iy, iz] = comp_x[ix, iy, iz] + comp_y[ix, iy, iz] + comp_z[ix, iy, iz]
        __Pyx_TraceLine(331,0,__PYX_ERR(0, 331, __pyx_L1_error))
        __pyx_t_25 = __pyx_v_ix;
        __pyx_t_24 = __pyx_v_iy;
        __pyx_t_23 = __pyx_v_iz;
        __pyx_t_22 = __pyx_v_ix;
        __pyx_t_21 = __pyx_v_iy;
        __pyx_t_20 = __pyx_v_iz;
        __pyx_t_19 = __pyx_v_ix;
        __pyx_t_18 = __pyx_v_iy;
        __pyx_t_17 = __pyx_v_iz;
        __pyx_t_28 = __pyx_v_ix;
        __pyx_t_27 = __pyx_v_iy;
        __pyx_t_26 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_invariant_y.data + __pyx_t_28 * __pyx_v_invariant_y.strides[0]) ) + __pyx_t_27 * __pyx_v_invariant_y.strides[1]) )) + __pyx_t_26)) )) = (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_x.data + __pyx_t_25 * __pyx_v_comp_x.strides[0]) ) + __pyx_t_24 * __pyx_v_comp_x.strides[1]) )) + __pyx_t_23)) ))) + (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_y.data + __pyx_t_22 * __pyx_v_comp_y.strides[0]) ) + __pyx_t_21 * __pyx_v_comp_y.strides[1]) )) + __pyx_t_20)) )))) + (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_z.data + __pyx_t_19 * __pyx_v_comp_z.strides[0]) ) + __pyx_t_18 * __pyx_v_comp_z.strides[1]) )) + __pyx_t_17)) ))));
      }
    }
  }
 332: 
+333:     comp_x = du3d(cdiv3d(dxn_dzp, J), axis=0)
  __Pyx_TraceLine(333,0,__PYX_ERR(0, 333, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dxn_dzp, __pyx_v_J); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 333, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_6, 0, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 333, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_x, 1);
  __pyx_v_comp_x = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
+334:     comp_y = du3d(cdiv3d(dyn_dzp, J), axis=1)
  __Pyx_TraceLine(334,0,__PYX_ERR(0, 334, __pyx_L1_error))
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dyn_dzp, __pyx_v_J); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 334, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_7, 1, 0, NULL); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 334, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_y, 1);
  __pyx_v_comp_y = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
+335:     comp_z = du3d(cdiv3d(dzn_dzp, J), axis=2)
  __Pyx_TraceLine(335,0,__PYX_ERR(0, 335, __pyx_L1_error))
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_cdiv3d(__pyx_v_dzn_dzp, __pyx_v_J); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 335, __pyx_L1_error)
  __pyx_t_7 = __pyx_f_6libfds_6cmaths_du3d(__pyx_t_6, 2, 0, NULL); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 335, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_comp_z, 1);
  __pyx_v_comp_z = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
 336: 
+337:     for ix in range(nx):
  __Pyx_TraceLine(337,0,__PYX_ERR(0, 337, __pyx_L1_error))
  __pyx_t_8 = __pyx_v_nx;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_ix = __pyx_t_10;
+338:         for iy in range(ny):
    __Pyx_TraceLine(338,0,__PYX_ERR(0, 338, __pyx_L1_error))
    __pyx_t_11 = __pyx_v_ny;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_iy = __pyx_t_13;
+339:             for iz in range(nz):
      __Pyx_TraceLine(339,0,__PYX_ERR(0, 339, __pyx_L1_error))
      __pyx_t_14 = __pyx_v_nz;
      __pyx_t_15 = __pyx_t_14;
      for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
        __pyx_v_iz = __pyx_t_16;
+340:                 invariant_z[ix, iy, iz] = comp_x[ix, iy, iz] + comp_y[ix, iy, iz] + comp_z[ix, iy, iz]
        __Pyx_TraceLine(340,0,__PYX_ERR(0, 340, __pyx_L1_error))
        __pyx_t_17 = __pyx_v_ix;
        __pyx_t_18 = __pyx_v_iy;
        __pyx_t_19 = __pyx_v_iz;
        __pyx_t_20 = __pyx_v_ix;
        __pyx_t_21 = __pyx_v_iy;
        __pyx_t_22 = __pyx_v_iz;
        __pyx_t_23 = __pyx_v_ix;
        __pyx_t_24 = __pyx_v_iy;
        __pyx_t_25 = __pyx_v_iz;
        __pyx_t_26 = __pyx_v_ix;
        __pyx_t_27 = __pyx_v_iy;
        __pyx_t_28 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_invariant_z.data + __pyx_t_26 * __pyx_v_invariant_z.strides[0]) ) + __pyx_t_27 * __pyx_v_invariant_z.strides[1]) )) + __pyx_t_28)) )) = (((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_x.data + __pyx_t_17 * __pyx_v_comp_x.strides[0]) ) + __pyx_t_18 * __pyx_v_comp_x.strides[1]) )) + __pyx_t_19)) ))) + (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_y.data + __pyx_t_20 * __pyx_v_comp_y.strides[0]) ) + __pyx_t_21 * __pyx_v_comp_y.strides[1]) )) + __pyx_t_22)) )))) + (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_comp_z.data + __pyx_t_23 * __pyx_v_comp_z.strides[0]) ) + __pyx_t_24 * __pyx_v_comp_z.strides[1]) )) + __pyx_t_25)) ))));
      }
    }
  }
 341: 
+342:     return invariant_x, invariant_y, invariant_z
  __Pyx_TraceLine(342,0,__PYX_ERR(0, 342, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_invariant_x, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_invariant_y, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_invariant_z, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;
 343: 
 344: 
+345: cdef double[:, ::1] cinv2d(double[:, ::1] b):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_cinv2d(__Pyx_memviewslice __pyx_v_b) {
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("cinv2d", __pyx_f[0], 345, 0, __PYX_ERR(0, 345, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.cinv2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(345,0,__PYX_ERR(0, 345, __pyx_L1_error))

 346: 
+347:     cdef Py_ssize_t nx = b.shape[0]
  __Pyx_TraceLine(347,0,__PYX_ERR(0, 347, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_b.shape[0]);
+348:     cdef Py_ssize_t ny = b.shape[1]
  __Pyx_TraceLine(348,0,__PYX_ERR(0, 348, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_b.shape[1]);
+349:     cdef double[:, ::1] out = np.empty_like(b)
  __Pyx_TraceLine(349,0,__PYX_ERR(0, 349, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_b, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 350: 
+351:     for ix in range(nx):
  __Pyx_TraceLine(351,0,__PYX_ERR(0, 351, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+352:         for iy in range(ny):
    __Pyx_TraceLine(352,0,__PYX_ERR(0, 352, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+353:             out[ix, iy] = 1. / b[ix, iy]
      __Pyx_TraceLine(353,0,__PYX_ERR(0, 353, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_ix;
      __pyx_t_14 = __pyx_v_iy;
      __pyx_t_15 = __pyx_v_ix;
      __pyx_t_16 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_15 * __pyx_v_out.strides[0]) )) + __pyx_t_16)) )) = (1. / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_b.data + __pyx_t_13 * __pyx_v_b.strides[0]) )) + __pyx_t_14)) ))));
    }
  }
 354: 
+355:     return out
  __Pyx_TraceLine(355,0,__PYX_ERR(0, 355, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 356: 
 357: 
+358: cdef double[:, :, ::1] cinv3d(double[:, :, ::1] b):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_cinv3d(__Pyx_memviewslice __pyx_v_b) {
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("cinv3d", __pyx_f[0], 358, 0, __PYX_ERR(0, 358, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.cinv3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(358,0,__PYX_ERR(0, 358, __pyx_L1_error))

 359: 
+360:     cdef Py_ssize_t nx = b.shape[0]
  __Pyx_TraceLine(360,0,__PYX_ERR(0, 360, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_b.shape[0]);
+361:     cdef Py_ssize_t ny = b.shape[1]
  __Pyx_TraceLine(361,0,__PYX_ERR(0, 361, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_b.shape[1]);
+362:     cdef Py_ssize_t nz = b.shape[2]
  __Pyx_TraceLine(362,0,__PYX_ERR(0, 362, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_b.shape[2]);
+363:     cdef double[:, :, ::1] out = np.empty_like(b)
  __Pyx_TraceLine(363,0,__PYX_ERR(0, 363, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_b, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 364: 
+365:     for ix in range(nx):
  __Pyx_TraceLine(365,0,__PYX_ERR(0, 365, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+366:         for iy in range(ny):
    __Pyx_TraceLine(366,0,__PYX_ERR(0, 366, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+367:             for iz in range(nz):
      __Pyx_TraceLine(367,0,__PYX_ERR(0, 367, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_nz;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_iz = __pyx_t_15;
+368:                 out[ix, iy, iz] = 1. / b[ix, iy, iz]
        __Pyx_TraceLine(368,0,__PYX_ERR(0, 368, __pyx_L1_error))
        __pyx_t_16 = __pyx_v_ix;
        __pyx_t_17 = __pyx_v_iy;
        __pyx_t_18 = __pyx_v_iz;
        __pyx_t_19 = __pyx_v_ix;
        __pyx_t_20 = __pyx_v_iy;
        __pyx_t_21 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_19 * __pyx_v_out.strides[0]) ) + __pyx_t_20 * __pyx_v_out.strides[1]) )) + __pyx_t_21)) )) = (1. / (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_b.data + __pyx_t_16 * __pyx_v_b.strides[0]) ) + __pyx_t_17 * __pyx_v_b.strides[1]) )) + __pyx_t_18)) ))));
      }
    }
  }
 369: 
+370:     return out
  __Pyx_TraceLine(370,0,__PYX_ERR(0, 370, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 371: 
 372: 
+373: cdef double[::1] cdiv1d(double[::1] a, double[::1] b):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_cdiv1d(__Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_b) {
  Py_ssize_t __pyx_v_nx;
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("cdiv1d", __pyx_f[0], 373, 0, __PYX_ERR(0, 373, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.cdiv1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(373,0,__PYX_ERR(0, 373, __pyx_L1_error))

 374: 
+375:     cdef Py_ssize_t nx = a.shape[0]
  __Pyx_TraceLine(375,0,__PYX_ERR(0, 375, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_a.shape[0]);
+376:     cdef double[::1] out = np.empty_like(a)
  __Pyx_TraceLine(376,0,__PYX_ERR(0, 376, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_a, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 377: 
+378:     for ix in range(nx):
  __Pyx_TraceLine(378,0,__PYX_ERR(0, 378, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+379:         out[ix] = a[ix] / b[ix]
    __Pyx_TraceLine(379,0,__PYX_ERR(0, 379, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ix;
    __pyx_t_11 = __pyx_v_ix;
    __pyx_t_12 = __pyx_v_ix;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_out.data) + __pyx_t_12)) )) = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_a.data) + __pyx_t_10)) ))) / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_b.data) + __pyx_t_11)) ))));
  }
 380: 
+381:     return out
  __Pyx_TraceLine(381,0,__PYX_ERR(0, 381, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 382: 
 383: 
+384: cdef double[:, ::1] cdiv2d(double[:, ::1] a, double[:, ::1] b):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_cdiv2d(__Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_b) {
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("cdiv2d", __pyx_f[0], 384, 0, __PYX_ERR(0, 384, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.cdiv2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(384,0,__PYX_ERR(0, 384, __pyx_L1_error))

 385: 
+386:     cdef Py_ssize_t nx = a.shape[0]
  __Pyx_TraceLine(386,0,__PYX_ERR(0, 386, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_a.shape[0]);
+387:     cdef Py_ssize_t ny = a.shape[1]
  __Pyx_TraceLine(387,0,__PYX_ERR(0, 387, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_a.shape[1]);
+388:     cdef double[:, ::1] out = np.empty_like(a)
  __Pyx_TraceLine(388,0,__PYX_ERR(0, 388, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_a, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 389: 
+390:     for ix in range(nx):
  __Pyx_TraceLine(390,0,__PYX_ERR(0, 390, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+391:         for iy in range(ny):
    __Pyx_TraceLine(391,0,__PYX_ERR(0, 391, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+392:             out[ix, iy] = a[ix, iy] / b[ix, iy]
      __Pyx_TraceLine(392,0,__PYX_ERR(0, 392, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_ix;
      __pyx_t_14 = __pyx_v_iy;
      __pyx_t_15 = __pyx_v_ix;
      __pyx_t_16 = __pyx_v_iy;
      __pyx_t_17 = __pyx_v_ix;
      __pyx_t_18 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_17 * __pyx_v_out.strides[0]) )) + __pyx_t_18)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_13 * __pyx_v_a.strides[0]) )) + __pyx_t_14)) ))) / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_b.data + __pyx_t_15 * __pyx_v_b.strides[0]) )) + __pyx_t_16)) ))));
    }
  }
 393: 
+394:     return out
  __Pyx_TraceLine(394,0,__PYX_ERR(0, 394, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 395: 
 396: 
+397: cdef double[:, :, ::1] cdiv3d(double[:, :, ::1] a, double[:, :, ::1] b):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_cdiv3d(__Pyx_memviewslice __pyx_v_a, __Pyx_memviewslice __pyx_v_b) {
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("cdiv3d", __pyx_f[0], 397, 0, __PYX_ERR(0, 397, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.cdiv3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(397,0,__PYX_ERR(0, 397, __pyx_L1_error))

 398: 
+399:     cdef Py_ssize_t nx = a.shape[0]
  __Pyx_TraceLine(399,0,__PYX_ERR(0, 399, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_a.shape[0]);
+400:     cdef Py_ssize_t ny = a.shape[1]
  __Pyx_TraceLine(400,0,__PYX_ERR(0, 400, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_a.shape[1]);
+401:     cdef Py_ssize_t nz = a.shape[2]
  __Pyx_TraceLine(401,0,__PYX_ERR(0, 401, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_a.shape[2]);
+402:     cdef double[:, :, ::1] out = np.empty_like(a)
  __Pyx_TraceLine(402,0,__PYX_ERR(0, 402, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_a, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_out = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 403: 
+404:     for ix in range(nx):
  __Pyx_TraceLine(404,0,__PYX_ERR(0, 404, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+405:         for iy in range(ny):
    __Pyx_TraceLine(405,0,__PYX_ERR(0, 405, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+406:             for iz in range(nz):
      __Pyx_TraceLine(406,0,__PYX_ERR(0, 406, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_nz;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_iz = __pyx_t_15;
+407:                 out[ix, iy, iz] = a[ix, iy, iz] / b[ix, iy, iz]
        __Pyx_TraceLine(407,0,__PYX_ERR(0, 407, __pyx_L1_error))
        __pyx_t_16 = __pyx_v_ix;
        __pyx_t_17 = __pyx_v_iy;
        __pyx_t_18 = __pyx_v_iz;
        __pyx_t_19 = __pyx_v_ix;
        __pyx_t_20 = __pyx_v_iy;
        __pyx_t_21 = __pyx_v_iz;
        __pyx_t_22 = __pyx_v_ix;
        __pyx_t_23 = __pyx_v_iy;
        __pyx_t_24 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_22 * __pyx_v_out.strides[0]) ) + __pyx_t_23 * __pyx_v_out.strides[1]) )) + __pyx_t_24)) )) = ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_a.data + __pyx_t_16 * __pyx_v_a.strides[0]) ) + __pyx_t_17 * __pyx_v_a.strides[1]) )) + __pyx_t_18)) ))) / (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_b.data + __pyx_t_19 * __pyx_v_b.strides[0]) ) + __pyx_t_20 * __pyx_v_b.strides[1]) )) + __pyx_t_21)) ))));
      }
    }
  }
 408: 
+409:     return out
  __Pyx_TraceLine(409,0,__PYX_ERR(0, 409, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_out, 1);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 410: 
 411: 
+412: cdef double[:, ::1] _du2d_x(double[:, ::1] v, double dx = 1.):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths__du2d_x(__Pyx_memviewslice __pyx_v_v, struct __pyx_opt_args_6libfds_6cmaths__du2d_x *__pyx_optional_args) {
  double __pyx_v_dx = ((double)1.);
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  double __pyx_v_odx;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  __Pyx_memviewslice __pyx_v_dv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_du2d_x", __pyx_f[0], 412, 0, __PYX_ERR(0, 412, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_dx = __pyx_optional_args->dx;
    }
  }
/* … */
  /* 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_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths._du2d_x", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dv, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(412,0,__PYX_ERR(0, 412, __pyx_L1_error))

 413: 
 414:     cdef Py_ssize_t ix, iy
+415:     cdef double odx = 1. / dx
  __Pyx_TraceLine(415,0,__PYX_ERR(0, 415, __pyx_L1_error))
  __pyx_v_odx = (1. / __pyx_v_dx);
+416:     cdef Py_ssize_t nx = v.shape[0]
  __Pyx_TraceLine(416,0,__PYX_ERR(0, 416, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_v.shape[0]);
+417:     cdef Py_ssize_t ny = v.shape[1]
  __Pyx_TraceLine(417,0,__PYX_ERR(0, 417, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_v.shape[1]);
+418:     cdef double[:, ::1] dv = np.zeros_like(v)
  __Pyx_TraceLine(418,0,__PYX_ERR(0, 418, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_v, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 419: 
+420:     for ix in range(5, nx - 5):
  __Pyx_TraceLine(420,0,__PYX_ERR(0, 420, __pyx_L1_error))
  __pyx_t_7 = (__pyx_v_nx - 5);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 5; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+421:         for iy in range(ny):
    __Pyx_TraceLine(421,0,__PYX_ERR(0, 421, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+422:             dv[ix, iy] = (a11c[1] * (v[ix+1, iy] - v[ix-1, iy]) +
      __Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L1_error))
      __pyx_t_13 = (__pyx_v_ix + 1);
      __pyx_t_14 = __pyx_v_iy;
      __pyx_t_15 = (__pyx_v_ix - 1);
      __pyx_t_16 = __pyx_v_iy;
/* … */
      __Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L1_error))
      __pyx_t_33 = __pyx_v_ix;
      __pyx_t_34 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_33 * __pyx_v_dv.strides[0]) )) + __pyx_t_34)) )) = (((((((a11c[1]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_13 * __pyx_v_v.strides[0]) )) + __pyx_t_14)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_15 * __pyx_v_v.strides[0]) )) + __pyx_t_16)) ))))) + ((a11c[2]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_17 * __pyx_v_v.strides[0]) )) + __pyx_t_18)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) )) + __pyx_t_20)) )))))) + ((a11c[3]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) )) + __pyx_t_22)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_23 * __pyx_v_v.strides[0]) )) + __pyx_t_24)) )))))) + ((a11c[4]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) )) + __pyx_t_26)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_27 * __pyx_v_v.strides[0]) )) + __pyx_t_28)) )))))) + ((a11c[5]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_29 * __pyx_v_v.strides[0]) )) + __pyx_t_30)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) )) + __pyx_t_32)) )))))) * __pyx_v_odx);
    }
  }
+423:                           a11c[2] * (v[ix+2, iy] - v[ix-2, iy]) +
      __Pyx_TraceLine(423,0,__PYX_ERR(0, 423, __pyx_L1_error))
      __pyx_t_17 = (__pyx_v_ix + 2);
      __pyx_t_18 = __pyx_v_iy;
      __pyx_t_19 = (__pyx_v_ix - 2);
      __pyx_t_20 = __pyx_v_iy;
+424:                           a11c[3] * (v[ix+3, iy] - v[ix-3, iy]) +
      __Pyx_TraceLine(424,0,__PYX_ERR(0, 424, __pyx_L1_error))
      __pyx_t_21 = (__pyx_v_ix + 3);
      __pyx_t_22 = __pyx_v_iy;
      __pyx_t_23 = (__pyx_v_ix - 3);
      __pyx_t_24 = __pyx_v_iy;
+425:                           a11c[4] * (v[ix+4, iy] - v[ix-4, iy]) +
      __Pyx_TraceLine(425,0,__PYX_ERR(0, 425, __pyx_L1_error))
      __pyx_t_25 = (__pyx_v_ix + 4);
      __pyx_t_26 = __pyx_v_iy;
      __pyx_t_27 = (__pyx_v_ix - 4);
      __pyx_t_28 = __pyx_v_iy;
+426:                           a11c[5] * (v[ix+5, iy] - v[ix-5, iy])) * odx
      __Pyx_TraceLine(426,0,__PYX_ERR(0, 426, __pyx_L1_error))
      __pyx_t_29 = (__pyx_v_ix + 5);
      __pyx_t_30 = __pyx_v_iy;
      __pyx_t_31 = (__pyx_v_ix - 5);
      __pyx_t_32 = __pyx_v_iy;
 427: 
+428:     for ix in range(0, 5):
  __Pyx_TraceLine(428,0,__PYX_ERR(0, 428, __pyx_L1_error))
  for (__pyx_t_7 = 0; __pyx_t_7 < 5; __pyx_t_7+=1) {
    __pyx_v_ix = __pyx_t_7;
+429:         for iy in range(ny):
    __Pyx_TraceLine(429,0,__PYX_ERR(0, 429, __pyx_L1_error))
    __pyx_t_8 = __pyx_v_ny;
    __pyx_t_9 = __pyx_t_8;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_iy = __pyx_t_10;
+430:             dv[ix, iy] = (a11d[ix][0] * v[0, iy] +
      __Pyx_TraceLine(430,0,__PYX_ERR(0, 430, __pyx_L1_error))
      __pyx_t_32 = 0;
      __pyx_t_31 = __pyx_v_iy;
/* … */
      __Pyx_TraceLine(430,0,__PYX_ERR(0, 430, __pyx_L1_error))
      __pyx_t_35 = __pyx_v_ix;
      __pyx_t_36 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_35 * __pyx_v_dv.strides[0]) )) + __pyx_t_36)) )) = ((((((((((((((a11d[__pyx_v_ix])[0]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_32 * __pyx_v_v.strides[0]) )) + __pyx_t_31)) )))) + (((a11d[__pyx_v_ix])[1]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_30 * __pyx_v_v.strides[0]) )) + __pyx_t_29)) ))))) + (((a11d[__pyx_v_ix])[2]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_28 * __pyx_v_v.strides[0]) )) + __pyx_t_27)) ))))) + (((a11d[__pyx_v_ix])[3]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_26 * __pyx_v_v.strides[0]) )) + __pyx_t_25)) ))))) + (((a11d[__pyx_v_ix])[4]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_24 * __pyx_v_v.strides[0]) )) + __pyx_t_23)) ))))) + (((a11d[__pyx_v_ix])[5]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )) + __pyx_t_21)) ))))) + (((a11d[__pyx_v_ix])[6]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_20 * __pyx_v_v.strides[0]) )) + __pyx_t_19)) ))))) + (((a11d[__pyx_v_ix])[7]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_18 * __pyx_v_v.strides[0]) )) + __pyx_t_17)) ))))) + (((a11d[__pyx_v_ix])[8]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_16 * __pyx_v_v.strides[0]) )) + __pyx_t_15)) ))))) + (((a11d[__pyx_v_ix])[9]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_14 * __pyx_v_v.strides[0]) )) + __pyx_t_13)) ))))) + (((a11d[__pyx_v_ix])[10]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_34 * __pyx_v_v.strides[0]) )) + __pyx_t_33)) ))))) * __pyx_v_odx);
    }
  }
+431:                           a11d[ix][1] * v[1, iy] +
      __Pyx_TraceLine(431,0,__PYX_ERR(0, 431, __pyx_L1_error))
      __pyx_t_30 = 1;
      __pyx_t_29 = __pyx_v_iy;
+432:                           a11d[ix][2] * v[2, iy] +
      __Pyx_TraceLine(432,0,__PYX_ERR(0, 432, __pyx_L1_error))
      __pyx_t_28 = 2;
      __pyx_t_27 = __pyx_v_iy;
+433:                           a11d[ix][3] * v[3, iy] +
      __Pyx_TraceLine(433,0,__PYX_ERR(0, 433, __pyx_L1_error))
      __pyx_t_26 = 3;
      __pyx_t_25 = __pyx_v_iy;
+434:                           a11d[ix][4] * v[4, iy] +
      __Pyx_TraceLine(434,0,__PYX_ERR(0, 434, __pyx_L1_error))
      __pyx_t_24 = 4;
      __pyx_t_23 = __pyx_v_iy;
+435:                           a11d[ix][5] * v[5, iy] +
      __Pyx_TraceLine(435,0,__PYX_ERR(0, 435, __pyx_L1_error))
      __pyx_t_22 = 5;
      __pyx_t_21 = __pyx_v_iy;
+436:                           a11d[ix][6] * v[6, iy] +
      __Pyx_TraceLine(436,0,__PYX_ERR(0, 436, __pyx_L1_error))
      __pyx_t_20 = 6;
      __pyx_t_19 = __pyx_v_iy;
+437:                           a11d[ix][7] * v[7, iy] +
      __Pyx_TraceLine(437,0,__PYX_ERR(0, 437, __pyx_L1_error))
      __pyx_t_18 = 7;
      __pyx_t_17 = __pyx_v_iy;
+438:                           a11d[ix][8] * v[8, iy] +
      __Pyx_TraceLine(438,0,__PYX_ERR(0, 438, __pyx_L1_error))
      __pyx_t_16 = 8;
      __pyx_t_15 = __pyx_v_iy;
+439:                           a11d[ix][9] * v[9, iy] +
      __Pyx_TraceLine(439,0,__PYX_ERR(0, 439, __pyx_L1_error))
      __pyx_t_14 = 9;
      __pyx_t_13 = __pyx_v_iy;
+440:                           a11d[ix][10] * v[10, iy]) * odx
      __Pyx_TraceLine(440,0,__PYX_ERR(0, 440, __pyx_L1_error))
      __pyx_t_34 = 10;
      __pyx_t_33 = __pyx_v_iy;
 441: 
+442:     for ix in range(nx-1, nx-6, -1):
  __Pyx_TraceLine(442,0,__PYX_ERR(0, 442, __pyx_L1_error))
  __pyx_t_7 = (__pyx_v_nx - 6);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = (__pyx_v_nx - 1); __pyx_t_9 > __pyx_t_8; __pyx_t_9-=1) {
    __pyx_v_ix = __pyx_t_9;
+443:         for iy in range(ny):
    __Pyx_TraceLine(443,0,__PYX_ERR(0, 443, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+444:             dv[ix, iy] = - (a11d[nx-ix-1][0] * v[nx-1, iy] +
      __Pyx_TraceLine(444,0,__PYX_ERR(0, 444, __pyx_L1_error))
      __pyx_t_33 = (__pyx_v_nx - 1);
      __pyx_t_34 = __pyx_v_iy;
/* … */
      __Pyx_TraceLine(444,0,__PYX_ERR(0, 444, __pyx_L1_error))
      __pyx_t_36 = __pyx_v_ix;
      __pyx_t_35 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_36 * __pyx_v_dv.strides[0]) )) + __pyx_t_35)) )) = ((-(((((((((((((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[0]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_33 * __pyx_v_v.strides[0]) )) + __pyx_t_34)) )))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[1]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_13 * __pyx_v_v.strides[0]) )) + __pyx_t_14)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[2]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_15 * __pyx_v_v.strides[0]) )) + __pyx_t_16)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[3]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_17 * __pyx_v_v.strides[0]) )) + __pyx_t_18)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[4]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) )) + __pyx_t_20)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[5]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) )) + __pyx_t_22)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[6]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_23 * __pyx_v_v.strides[0]) )) + __pyx_t_24)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[7]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) )) + __pyx_t_26)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[8]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_27 * __pyx_v_v.strides[0]) )) + __pyx_t_28)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[9]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_29 * __pyx_v_v.strides[0]) )) + __pyx_t_30)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[10]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) )) + __pyx_t_32)) )))))) * __pyx_v_odx);
    }
  }
+445:                             a11d[nx-ix-1][1] * v[nx-2, iy] +
      __Pyx_TraceLine(445,0,__PYX_ERR(0, 445, __pyx_L1_error))
      __pyx_t_13 = (__pyx_v_nx - 2);
      __pyx_t_14 = __pyx_v_iy;
+446:                             a11d[nx-ix-1][2] * v[nx-3, iy] +
      __Pyx_TraceLine(446,0,__PYX_ERR(0, 446, __pyx_L1_error))
      __pyx_t_15 = (__pyx_v_nx - 3);
      __pyx_t_16 = __pyx_v_iy;
+447:                             a11d[nx-ix-1][3] * v[nx-4, iy] +
      __Pyx_TraceLine(447,0,__PYX_ERR(0, 447, __pyx_L1_error))
      __pyx_t_17 = (__pyx_v_nx - 4);
      __pyx_t_18 = __pyx_v_iy;
+448:                             a11d[nx-ix-1][4] * v[nx-5, iy] +
      __Pyx_TraceLine(448,0,__PYX_ERR(0, 448, __pyx_L1_error))
      __pyx_t_19 = (__pyx_v_nx - 5);
      __pyx_t_20 = __pyx_v_iy;
+449:                             a11d[nx-ix-1][5] * v[nx-6, iy] +
      __Pyx_TraceLine(449,0,__PYX_ERR(0, 449, __pyx_L1_error))
      __pyx_t_21 = (__pyx_v_nx - 6);
      __pyx_t_22 = __pyx_v_iy;
+450:                             a11d[nx-ix-1][6] * v[nx-7, iy] +
      __Pyx_TraceLine(450,0,__PYX_ERR(0, 450, __pyx_L1_error))
      __pyx_t_23 = (__pyx_v_nx - 7);
      __pyx_t_24 = __pyx_v_iy;
+451:                             a11d[nx-ix-1][7] * v[nx-8, iy] +
      __Pyx_TraceLine(451,0,__PYX_ERR(0, 451, __pyx_L1_error))
      __pyx_t_25 = (__pyx_v_nx - 8);
      __pyx_t_26 = __pyx_v_iy;
+452:                             a11d[nx-ix-1][8] * v[nx-9, iy] +
      __Pyx_TraceLine(452,0,__PYX_ERR(0, 452, __pyx_L1_error))
      __pyx_t_27 = (__pyx_v_nx - 9);
      __pyx_t_28 = __pyx_v_iy;
+453:                             a11d[nx-ix-1][9] * v[nx-10, iy] +
      __Pyx_TraceLine(453,0,__PYX_ERR(0, 453, __pyx_L1_error))
      __pyx_t_29 = (__pyx_v_nx - 10);
      __pyx_t_30 = __pyx_v_iy;
+454:                             a11d[nx-ix-1][10] * v[nx-11, iy]) * odx
      __Pyx_TraceLine(454,0,__PYX_ERR(0, 454, __pyx_L1_error))
      __pyx_t_31 = (__pyx_v_nx - 11);
      __pyx_t_32 = __pyx_v_iy;
 455: 
+456:     return dv
  __Pyx_TraceLine(456,0,__PYX_ERR(0, 456, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_dv, 1);
  __pyx_r = __pyx_v_dv;
  goto __pyx_L0;
 457: 
 458: 
+459: cdef double[:, ::1] _du2d_y(double[:, ::1] v, double dy = 1.):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths__du2d_y(__Pyx_memviewslice __pyx_v_v, struct __pyx_opt_args_6libfds_6cmaths__du2d_y *__pyx_optional_args) {
  double __pyx_v_dy = ((double)1.);
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  double __pyx_v_ody;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  __Pyx_memviewslice __pyx_v_dv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_du2d_y", __pyx_f[0], 459, 0, __PYX_ERR(0, 459, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_dy = __pyx_optional_args->dy;
    }
  }
/* … */
  /* 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_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths._du2d_y", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dv, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(459,0,__PYX_ERR(0, 459, __pyx_L1_error))

 460: 
 461:     cdef Py_ssize_t ix, iy
+462:     cdef double ody = 1. / dy
  __Pyx_TraceLine(462,0,__PYX_ERR(0, 462, __pyx_L1_error))
  __pyx_v_ody = (1. / __pyx_v_dy);
+463:     cdef Py_ssize_t nx = v.shape[0]
  __Pyx_TraceLine(463,0,__PYX_ERR(0, 463, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_v.shape[0]);
+464:     cdef Py_ssize_t ny = v.shape[1]
  __Pyx_TraceLine(464,0,__PYX_ERR(0, 464, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_v.shape[1]);
+465:     cdef double[:, ::1] dv = np.zeros_like(v)
  __Pyx_TraceLine(465,0,__PYX_ERR(0, 465, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_v, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 466: 
+467:     for ix in range(nx):
  __Pyx_TraceLine(467,0,__PYX_ERR(0, 467, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+468:         for iy in range(5, ny - 5):
    __Pyx_TraceLine(468,0,__PYX_ERR(0, 468, __pyx_L1_error))
    __pyx_t_10 = (__pyx_v_ny - 5);
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 5; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+469:             dv[ix, iy] = (a11c[1] * (v[ix, iy+1] - v[ix, iy-1]) +
      __Pyx_TraceLine(469,0,__PYX_ERR(0, 469, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_ix;
      __pyx_t_14 = (__pyx_v_iy + 1);
      __pyx_t_15 = __pyx_v_ix;
      __pyx_t_16 = (__pyx_v_iy - 1);
/* … */
      __Pyx_TraceLine(469,0,__PYX_ERR(0, 469, __pyx_L1_error))
      __pyx_t_33 = __pyx_v_ix;
      __pyx_t_34 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_33 * __pyx_v_dv.strides[0]) )) + __pyx_t_34)) )) = (((((((a11c[1]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_13 * __pyx_v_v.strides[0]) )) + __pyx_t_14)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_15 * __pyx_v_v.strides[0]) )) + __pyx_t_16)) ))))) + ((a11c[2]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_17 * __pyx_v_v.strides[0]) )) + __pyx_t_18)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) )) + __pyx_t_20)) )))))) + ((a11c[3]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) )) + __pyx_t_22)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_23 * __pyx_v_v.strides[0]) )) + __pyx_t_24)) )))))) + ((a11c[4]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) )) + __pyx_t_26)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_27 * __pyx_v_v.strides[0]) )) + __pyx_t_28)) )))))) + ((a11c[5]) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_29 * __pyx_v_v.strides[0]) )) + __pyx_t_30)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) )) + __pyx_t_32)) )))))) * __pyx_v_ody);
    }
  }
+470:                           a11c[2] * (v[ix, iy+2] - v[ix, iy-2]) +
      __Pyx_TraceLine(470,0,__PYX_ERR(0, 470, __pyx_L1_error))
      __pyx_t_17 = __pyx_v_ix;
      __pyx_t_18 = (__pyx_v_iy + 2);
      __pyx_t_19 = __pyx_v_ix;
      __pyx_t_20 = (__pyx_v_iy - 2);
+471:                           a11c[3] * (v[ix, iy+3] - v[ix, iy-3]) +
      __Pyx_TraceLine(471,0,__PYX_ERR(0, 471, __pyx_L1_error))
      __pyx_t_21 = __pyx_v_ix;
      __pyx_t_22 = (__pyx_v_iy + 3);
      __pyx_t_23 = __pyx_v_ix;
      __pyx_t_24 = (__pyx_v_iy - 3);
+472:                           a11c[4] * (v[ix, iy+4] - v[ix, iy-4]) +
      __Pyx_TraceLine(472,0,__PYX_ERR(0, 472, __pyx_L1_error))
      __pyx_t_25 = __pyx_v_ix;
      __pyx_t_26 = (__pyx_v_iy + 4);
      __pyx_t_27 = __pyx_v_ix;
      __pyx_t_28 = (__pyx_v_iy - 4);
+473:                           a11c[5] * (v[ix, iy+5] - v[ix, iy-5])) * ody
      __Pyx_TraceLine(473,0,__PYX_ERR(0, 473, __pyx_L1_error))
      __pyx_t_29 = __pyx_v_ix;
      __pyx_t_30 = (__pyx_v_iy + 5);
      __pyx_t_31 = __pyx_v_ix;
      __pyx_t_32 = (__pyx_v_iy - 5);
 474: 
+475:     for ix in range(nx):
  __Pyx_TraceLine(475,0,__PYX_ERR(0, 475, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+476:         for iy in range(0, 5):
    __Pyx_TraceLine(476,0,__PYX_ERR(0, 476, __pyx_L1_error))
    for (__pyx_t_10 = 0; __pyx_t_10 < 5; __pyx_t_10+=1) {
      __pyx_v_iy = __pyx_t_10;
+477:             dv[ix, iy] = (a11d[iy][0] * v[ix, 0] +
      __Pyx_TraceLine(477,0,__PYX_ERR(0, 477, __pyx_L1_error))
      __pyx_t_32 = __pyx_v_ix;
      __pyx_t_31 = 0;
/* … */
      __Pyx_TraceLine(477,0,__PYX_ERR(0, 477, __pyx_L1_error))
      __pyx_t_35 = __pyx_v_ix;
      __pyx_t_36 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_35 * __pyx_v_dv.strides[0]) )) + __pyx_t_36)) )) = ((((((((((((((a11d[__pyx_v_iy])[0]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_32 * __pyx_v_v.strides[0]) )) + __pyx_t_31)) )))) + (((a11d[__pyx_v_iy])[1]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_30 * __pyx_v_v.strides[0]) )) + __pyx_t_29)) ))))) + (((a11d[__pyx_v_iy])[2]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_28 * __pyx_v_v.strides[0]) )) + __pyx_t_27)) ))))) + (((a11d[__pyx_v_iy])[3]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_26 * __pyx_v_v.strides[0]) )) + __pyx_t_25)) ))))) + (((a11d[__pyx_v_iy])[4]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_24 * __pyx_v_v.strides[0]) )) + __pyx_t_23)) ))))) + (((a11d[__pyx_v_iy])[5]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )) + __pyx_t_21)) ))))) + (((a11d[__pyx_v_iy])[6]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_20 * __pyx_v_v.strides[0]) )) + __pyx_t_19)) ))))) + (((a11d[__pyx_v_iy])[7]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_18 * __pyx_v_v.strides[0]) )) + __pyx_t_17)) ))))) + (((a11d[__pyx_v_iy])[8]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_16 * __pyx_v_v.strides[0]) )) + __pyx_t_15)) ))))) + (((a11d[__pyx_v_iy])[9]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_14 * __pyx_v_v.strides[0]) )) + __pyx_t_13)) ))))) + (((a11d[__pyx_v_iy])[10]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_34 * __pyx_v_v.strides[0]) )) + __pyx_t_33)) ))))) * __pyx_v_ody);
    }
  }
+478:                           a11d[iy][1] * v[ix, 1] +
      __Pyx_TraceLine(478,0,__PYX_ERR(0, 478, __pyx_L1_error))
      __pyx_t_30 = __pyx_v_ix;
      __pyx_t_29 = 1;
+479:                           a11d[iy][2] * v[ix, 2] +
      __Pyx_TraceLine(479,0,__PYX_ERR(0, 479, __pyx_L1_error))
      __pyx_t_28 = __pyx_v_ix;
      __pyx_t_27 = 2;
+480:                           a11d[iy][3] * v[ix, 3] +
      __Pyx_TraceLine(480,0,__PYX_ERR(0, 480, __pyx_L1_error))
      __pyx_t_26 = __pyx_v_ix;
      __pyx_t_25 = 3;
+481:                           a11d[iy][4] * v[ix, 4] +
      __Pyx_TraceLine(481,0,__PYX_ERR(0, 481, __pyx_L1_error))
      __pyx_t_24 = __pyx_v_ix;
      __pyx_t_23 = 4;
+482:                           a11d[iy][5] * v[ix, 5] +
      __Pyx_TraceLine(482,0,__PYX_ERR(0, 482, __pyx_L1_error))
      __pyx_t_22 = __pyx_v_ix;
      __pyx_t_21 = 5;
+483:                           a11d[iy][6] * v[ix, 6] +
      __Pyx_TraceLine(483,0,__PYX_ERR(0, 483, __pyx_L1_error))
      __pyx_t_20 = __pyx_v_ix;
      __pyx_t_19 = 6;
+484:                           a11d[iy][7] * v[ix, 7] +
      __Pyx_TraceLine(484,0,__PYX_ERR(0, 484, __pyx_L1_error))
      __pyx_t_18 = __pyx_v_ix;
      __pyx_t_17 = 7;
+485:                           a11d[iy][8] * v[ix, 8] +
      __Pyx_TraceLine(485,0,__PYX_ERR(0, 485, __pyx_L1_error))
      __pyx_t_16 = __pyx_v_ix;
      __pyx_t_15 = 8;
+486:                           a11d[iy][9] * v[ix, 9] +
      __Pyx_TraceLine(486,0,__PYX_ERR(0, 486, __pyx_L1_error))
      __pyx_t_14 = __pyx_v_ix;
      __pyx_t_13 = 9;
+487:                           a11d[iy][10] * v[ix, 10]) * ody
      __Pyx_TraceLine(487,0,__PYX_ERR(0, 487, __pyx_L1_error))
      __pyx_t_34 = __pyx_v_ix;
      __pyx_t_33 = 10;
 488: 
+489:     for ix in range(nx):
  __Pyx_TraceLine(489,0,__PYX_ERR(0, 489, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+490:         for iy in range(ny-1, ny-6, -1):
    __Pyx_TraceLine(490,0,__PYX_ERR(0, 490, __pyx_L1_error))
    __pyx_t_10 = (__pyx_v_ny - 6);
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = (__pyx_v_ny - 1); __pyx_t_12 > __pyx_t_11; __pyx_t_12-=1) {
      __pyx_v_iy = __pyx_t_12;
+491:             dv[ix, iy] = - (a11d[ny-iy-1][0] * v[ix, ny-1] +
      __Pyx_TraceLine(491,0,__PYX_ERR(0, 491, __pyx_L1_error))
      __pyx_t_33 = __pyx_v_ix;
      __pyx_t_34 = (__pyx_v_ny - 1);
/* … */
      __Pyx_TraceLine(491,0,__PYX_ERR(0, 491, __pyx_L1_error))
      __pyx_t_36 = __pyx_v_ix;
      __pyx_t_35 = __pyx_v_iy;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_36 * __pyx_v_dv.strides[0]) )) + __pyx_t_35)) )) = ((-(((((((((((((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[0]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_33 * __pyx_v_v.strides[0]) )) + __pyx_t_34)) )))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[1]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_13 * __pyx_v_v.strides[0]) )) + __pyx_t_14)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[2]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_15 * __pyx_v_v.strides[0]) )) + __pyx_t_16)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[3]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_17 * __pyx_v_v.strides[0]) )) + __pyx_t_18)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[4]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) )) + __pyx_t_20)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[5]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) )) + __pyx_t_22)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[6]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_23 * __pyx_v_v.strides[0]) )) + __pyx_t_24)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[7]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) )) + __pyx_t_26)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[8]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_27 * __pyx_v_v.strides[0]) )) + __pyx_t_28)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[9]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_29 * __pyx_v_v.strides[0]) )) + __pyx_t_30)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[10]) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) )) + __pyx_t_32)) )))))) * __pyx_v_ody);
    }
  }
+492:                             a11d[ny-iy-1][1] * v[ix, ny-2] +
      __Pyx_TraceLine(492,0,__PYX_ERR(0, 492, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_ix;
      __pyx_t_14 = (__pyx_v_ny - 2);
+493:                             a11d[ny-iy-1][2] * v[ix, ny-3] +
      __Pyx_TraceLine(493,0,__PYX_ERR(0, 493, __pyx_L1_error))
      __pyx_t_15 = __pyx_v_ix;
      __pyx_t_16 = (__pyx_v_ny - 3);
+494:                             a11d[ny-iy-1][3] * v[ix, ny-4] +
      __Pyx_TraceLine(494,0,__PYX_ERR(0, 494, __pyx_L1_error))
      __pyx_t_17 = __pyx_v_ix;
      __pyx_t_18 = (__pyx_v_ny - 4);
+495:                             a11d[ny-iy-1][4] * v[ix, ny-5] +
      __Pyx_TraceLine(495,0,__PYX_ERR(0, 495, __pyx_L1_error))
      __pyx_t_19 = __pyx_v_ix;
      __pyx_t_20 = (__pyx_v_ny - 5);
+496:                             a11d[ny-iy-1][5] * v[ix, ny-6] +
      __Pyx_TraceLine(496,0,__PYX_ERR(0, 496, __pyx_L1_error))
      __pyx_t_21 = __pyx_v_ix;
      __pyx_t_22 = (__pyx_v_ny - 6);
+497:                             a11d[ny-iy-1][6] * v[ix, ny-7] +
      __Pyx_TraceLine(497,0,__PYX_ERR(0, 497, __pyx_L1_error))
      __pyx_t_23 = __pyx_v_ix;
      __pyx_t_24 = (__pyx_v_ny - 7);
+498:                             a11d[ny-iy-1][7] * v[ix, ny-8] +
      __Pyx_TraceLine(498,0,__PYX_ERR(0, 498, __pyx_L1_error))
      __pyx_t_25 = __pyx_v_ix;
      __pyx_t_26 = (__pyx_v_ny - 8);
+499:                             a11d[ny-iy-1][8] * v[ix, ny-9] +
      __Pyx_TraceLine(499,0,__PYX_ERR(0, 499, __pyx_L1_error))
      __pyx_t_27 = __pyx_v_ix;
      __pyx_t_28 = (__pyx_v_ny - 9);
+500:                             a11d[ny-iy-1][9] * v[ix, ny-10] +
      __Pyx_TraceLine(500,0,__PYX_ERR(0, 500, __pyx_L1_error))
      __pyx_t_29 = __pyx_v_ix;
      __pyx_t_30 = (__pyx_v_ny - 10);
+501:                             a11d[ny-iy-1][10] * v[ix, ny-11]) * ody
      __Pyx_TraceLine(501,0,__PYX_ERR(0, 501, __pyx_L1_error))
      __pyx_t_31 = __pyx_v_ix;
      __pyx_t_32 = (__pyx_v_ny - 11);
 502: 
+503:     return dv
  __Pyx_TraceLine(503,0,__PYX_ERR(0, 503, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_dv, 1);
  __pyx_r = __pyx_v_dv;
  goto __pyx_L0;
 504: 
 505: 
+506: cdef double[:, :, ::1] _du3d_x(double[:, :, ::1] v, double dx = 1.):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths__du3d_x(__Pyx_memviewslice __pyx_v_v, struct __pyx_opt_args_6libfds_6cmaths__du3d_x *__pyx_optional_args) {
  double __pyx_v_dx = ((double)1.);
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  double __pyx_v_odx;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  __Pyx_memviewslice __pyx_v_dv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_du3d_x", __pyx_f[0], 506, 0, __PYX_ERR(0, 506, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_dx = __pyx_optional_args->dx;
    }
  }
/* … */
  /* 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_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths._du3d_x", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dv, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(506,0,__PYX_ERR(0, 506, __pyx_L1_error))

 507: 
 508:     cdef Py_ssize_t ix, iy, iz
+509:     cdef double odx = 1. / dx
  __Pyx_TraceLine(509,0,__PYX_ERR(0, 509, __pyx_L1_error))
  __pyx_v_odx = (1. / __pyx_v_dx);
+510:     cdef Py_ssize_t nx = v.shape[0]
  __Pyx_TraceLine(510,0,__PYX_ERR(0, 510, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_v.shape[0]);
+511:     cdef Py_ssize_t ny = v.shape[1]
  __Pyx_TraceLine(511,0,__PYX_ERR(0, 511, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_v.shape[1]);
+512:     cdef Py_ssize_t nz = v.shape[2]
  __Pyx_TraceLine(512,0,__PYX_ERR(0, 512, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_v.shape[2]);
+513:     cdef double[:, :, ::1] dv = np.zeros_like(v)
  __Pyx_TraceLine(513,0,__PYX_ERR(0, 513, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_v, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 514: 
+515:     for ix in range(5, nx - 5):
  __Pyx_TraceLine(515,0,__PYX_ERR(0, 515, __pyx_L1_error))
  __pyx_t_7 = (__pyx_v_nx - 5);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 5; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+516:         for iy in range(ny):
    __Pyx_TraceLine(516,0,__PYX_ERR(0, 516, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+517:             for iz in range(nz):
      __Pyx_TraceLine(517,0,__PYX_ERR(0, 517, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_nz;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_iz = __pyx_t_15;
+518:                 dv[ix, iy, iz] = (a11c[1] * (v[ix+1, iy, iz] - v[ix-1, iy, iz]) +
        __Pyx_TraceLine(518,0,__PYX_ERR(0, 518, __pyx_L1_error))
        __pyx_t_16 = (__pyx_v_ix + 1);
        __pyx_t_17 = __pyx_v_iy;
        __pyx_t_18 = __pyx_v_iz;
        __pyx_t_19 = (__pyx_v_ix - 1);
        __pyx_t_20 = __pyx_v_iy;
        __pyx_t_21 = __pyx_v_iz;
/* … */
        __Pyx_TraceLine(518,0,__PYX_ERR(0, 518, __pyx_L1_error))
        __pyx_t_46 = __pyx_v_ix;
        __pyx_t_47 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_46 * __pyx_v_dv.strides[0]) ) + __pyx_t_47 * __pyx_v_dv.strides[1]) )) + __pyx_t_48)) )) = (((((((a11c[1]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_16 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_18)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_21)) ))))) + ((a11c[2]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_24)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_27)) )))))) + ((a11c[3]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_28 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_30)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_33)) )))))) + ((a11c[4]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_34 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_36)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_37 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_39)) )))))) + ((a11c[5]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_40 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_42)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_43 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_45)) )))))) * __pyx_v_odx);
      }
    }
  }
+519:                                   a11c[2] * (v[ix+2, iy, iz] - v[ix-2, iy, iz]) +
        __Pyx_TraceLine(519,0,__PYX_ERR(0, 519, __pyx_L1_error))
        __pyx_t_22 = (__pyx_v_ix + 2);
        __pyx_t_23 = __pyx_v_iy;
        __pyx_t_24 = __pyx_v_iz;
        __pyx_t_25 = (__pyx_v_ix - 2);
        __pyx_t_26 = __pyx_v_iy;
        __pyx_t_27 = __pyx_v_iz;
+520:                                   a11c[3] * (v[ix+3, iy, iz] - v[ix-3, iy, iz]) +
        __Pyx_TraceLine(520,0,__PYX_ERR(0, 520, __pyx_L1_error))
        __pyx_t_28 = (__pyx_v_ix + 3);
        __pyx_t_29 = __pyx_v_iy;
        __pyx_t_30 = __pyx_v_iz;
        __pyx_t_31 = (__pyx_v_ix - 3);
        __pyx_t_32 = __pyx_v_iy;
        __pyx_t_33 = __pyx_v_iz;
+521:                                   a11c[4] * (v[ix+4, iy, iz] - v[ix-4, iy, iz]) +
        __Pyx_TraceLine(521,0,__PYX_ERR(0, 521, __pyx_L1_error))
        __pyx_t_34 = (__pyx_v_ix + 4);
        __pyx_t_35 = __pyx_v_iy;
        __pyx_t_36 = __pyx_v_iz;
        __pyx_t_37 = (__pyx_v_ix - 4);
        __pyx_t_38 = __pyx_v_iy;
        __pyx_t_39 = __pyx_v_iz;
+522:                                   a11c[5] * (v[ix+5, iy, iz] - v[ix-5, iy, iz])) * odx
        __Pyx_TraceLine(522,0,__PYX_ERR(0, 522, __pyx_L1_error))
        __pyx_t_40 = (__pyx_v_ix + 5);
        __pyx_t_41 = __pyx_v_iy;
        __pyx_t_42 = __pyx_v_iz;
        __pyx_t_43 = (__pyx_v_ix - 5);
        __pyx_t_44 = __pyx_v_iy;
        __pyx_t_45 = __pyx_v_iz;
 523: 
+524:     for ix in range(0, 5):
  __Pyx_TraceLine(524,0,__PYX_ERR(0, 524, __pyx_L1_error))
  for (__pyx_t_7 = 0; __pyx_t_7 < 5; __pyx_t_7+=1) {
    __pyx_v_ix = __pyx_t_7;
+525:         for iy in range(ny):
    __Pyx_TraceLine(525,0,__PYX_ERR(0, 525, __pyx_L1_error))
    __pyx_t_8 = __pyx_v_ny;
    __pyx_t_9 = __pyx_t_8;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_iy = __pyx_t_10;
+526:             for iz in range(nz):
      __Pyx_TraceLine(526,0,__PYX_ERR(0, 526, __pyx_L1_error))
      __pyx_t_11 = __pyx_v_nz;
      __pyx_t_12 = __pyx_t_11;
      for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
        __pyx_v_iz = __pyx_t_13;
+527:                 dv[ix, iy, iz] = (a11d[ix][0] * v[0, iy, iz] +
        __Pyx_TraceLine(527,0,__PYX_ERR(0, 527, __pyx_L1_error))
        __pyx_t_45 = 0;
        __pyx_t_44 = __pyx_v_iy;
        __pyx_t_43 = __pyx_v_iz;
/* … */
        __Pyx_TraceLine(527,0,__PYX_ERR(0, 527, __pyx_L1_error))
        __pyx_t_49 = __pyx_v_ix;
        __pyx_t_50 = __pyx_v_iy;
        __pyx_t_51 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_49 * __pyx_v_dv.strides[0]) ) + __pyx_t_50 * __pyx_v_dv.strides[1]) )) + __pyx_t_51)) )) = ((((((((((((((a11d[__pyx_v_ix])[0]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_45 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_43)) )))) + (((a11d[__pyx_v_ix])[1]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_42 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_40)) ))))) + (((a11d[__pyx_v_ix])[2]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_39 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_37)) ))))) + (((a11d[__pyx_v_ix])[3]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_36 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_34)) ))))) + (((a11d[__pyx_v_ix])[4]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_33 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_31)) ))))) + (((a11d[__pyx_v_ix])[5]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_30 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_28)) ))))) + (((a11d[__pyx_v_ix])[6]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_27 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_25)) ))))) + (((a11d[__pyx_v_ix])[7]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_24 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_22)) ))))) + (((a11d[__pyx_v_ix])[8]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_19)) ))))) + (((a11d[__pyx_v_ix])[9]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_18 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_16)) ))))) + (((a11d[__pyx_v_ix])[10]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_48 * __pyx_v_v.strides[0]) ) + __pyx_t_47 * __pyx_v_v.strides[1]) )) + __pyx_t_46)) ))))) * __pyx_v_odx);
      }
    }
  }
+528:                                   a11d[ix][1] * v[1, iy, iz] +
        __Pyx_TraceLine(528,0,__PYX_ERR(0, 528, __pyx_L1_error))
        __pyx_t_42 = 1;
        __pyx_t_41 = __pyx_v_iy;
        __pyx_t_40 = __pyx_v_iz;
+529:                                   a11d[ix][2] * v[2, iy, iz] +
        __Pyx_TraceLine(529,0,__PYX_ERR(0, 529, __pyx_L1_error))
        __pyx_t_39 = 2;
        __pyx_t_38 = __pyx_v_iy;
        __pyx_t_37 = __pyx_v_iz;
+530:                                   a11d[ix][3] * v[3, iy, iz] +
        __Pyx_TraceLine(530,0,__PYX_ERR(0, 530, __pyx_L1_error))
        __pyx_t_36 = 3;
        __pyx_t_35 = __pyx_v_iy;
        __pyx_t_34 = __pyx_v_iz;
+531:                                   a11d[ix][4] * v[4, iy, iz] +
        __Pyx_TraceLine(531,0,__PYX_ERR(0, 531, __pyx_L1_error))
        __pyx_t_33 = 4;
        __pyx_t_32 = __pyx_v_iy;
        __pyx_t_31 = __pyx_v_iz;
+532:                                   a11d[ix][5] * v[5, iy, iz] +
        __Pyx_TraceLine(532,0,__PYX_ERR(0, 532, __pyx_L1_error))
        __pyx_t_30 = 5;
        __pyx_t_29 = __pyx_v_iy;
        __pyx_t_28 = __pyx_v_iz;
+533:                                   a11d[ix][6] * v[6, iy, iz] +
        __Pyx_TraceLine(533,0,__PYX_ERR(0, 533, __pyx_L1_error))
        __pyx_t_27 = 6;
        __pyx_t_26 = __pyx_v_iy;
        __pyx_t_25 = __pyx_v_iz;
+534:                                   a11d[ix][7] * v[7, iy, iz] +
        __Pyx_TraceLine(534,0,__PYX_ERR(0, 534, __pyx_L1_error))
        __pyx_t_24 = 7;
        __pyx_t_23 = __pyx_v_iy;
        __pyx_t_22 = __pyx_v_iz;
+535:                                   a11d[ix][8] * v[8, iy, iz] +
        __Pyx_TraceLine(535,0,__PYX_ERR(0, 535, __pyx_L1_error))
        __pyx_t_21 = 8;
        __pyx_t_20 = __pyx_v_iy;
        __pyx_t_19 = __pyx_v_iz;
+536:                                   a11d[ix][9] * v[9, iy, iz] +
        __Pyx_TraceLine(536,0,__PYX_ERR(0, 536, __pyx_L1_error))
        __pyx_t_18 = 9;
        __pyx_t_17 = __pyx_v_iy;
        __pyx_t_16 = __pyx_v_iz;
+537:                                   a11d[ix][10] * v[10, iy, iz]) * odx
        __Pyx_TraceLine(537,0,__PYX_ERR(0, 537, __pyx_L1_error))
        __pyx_t_48 = 10;
        __pyx_t_47 = __pyx_v_iy;
        __pyx_t_46 = __pyx_v_iz;
 538: 
+539:     for ix in range(nx-1, nx-6, -1):
  __Pyx_TraceLine(539,0,__PYX_ERR(0, 539, __pyx_L1_error))
  __pyx_t_7 = (__pyx_v_nx - 6);
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = (__pyx_v_nx - 1); __pyx_t_9 > __pyx_t_8; __pyx_t_9-=1) {
    __pyx_v_ix = __pyx_t_9;
+540:         for iy in range(ny):
    __Pyx_TraceLine(540,0,__PYX_ERR(0, 540, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+541:             for iz in range(nz):
      __Pyx_TraceLine(541,0,__PYX_ERR(0, 541, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_nz;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_iz = __pyx_t_15;
+542:                 dv[ix, iy, iz] = - (a11d[nx-ix-1][0] * v[nx-1, iy, iz] +
        __Pyx_TraceLine(542,0,__PYX_ERR(0, 542, __pyx_L1_error))
        __pyx_t_46 = (__pyx_v_nx - 1);
        __pyx_t_47 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
/* … */
        __Pyx_TraceLine(542,0,__PYX_ERR(0, 542, __pyx_L1_error))
        __pyx_t_51 = __pyx_v_ix;
        __pyx_t_50 = __pyx_v_iy;
        __pyx_t_49 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_51 * __pyx_v_dv.strides[0]) ) + __pyx_t_50 * __pyx_v_dv.strides[1]) )) + __pyx_t_49)) )) = ((-(((((((((((((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[0]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_46 * __pyx_v_v.strides[0]) ) + __pyx_t_47 * __pyx_v_v.strides[1]) )) + __pyx_t_48)) )))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[1]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_16 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_18)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[2]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_21)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[3]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_24)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[4]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_27)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[5]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_28 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_30)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[6]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_33)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[7]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_34 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_36)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[8]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_37 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_39)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[9]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_40 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_42)) ))))) + (((a11d[((__pyx_v_nx - __pyx_v_ix) - 1)])[10]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_43 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_45)) )))))) * __pyx_v_odx);
      }
    }
  }
+543:                                     a11d[nx-ix-1][1] * v[nx-2, iy, iz] +
        __Pyx_TraceLine(543,0,__PYX_ERR(0, 543, __pyx_L1_error))
        __pyx_t_16 = (__pyx_v_nx - 2);
        __pyx_t_17 = __pyx_v_iy;
        __pyx_t_18 = __pyx_v_iz;
+544:                                     a11d[nx-ix-1][2] * v[nx-3, iy, iz] +
        __Pyx_TraceLine(544,0,__PYX_ERR(0, 544, __pyx_L1_error))
        __pyx_t_19 = (__pyx_v_nx - 3);
        __pyx_t_20 = __pyx_v_iy;
        __pyx_t_21 = __pyx_v_iz;
+545:                                     a11d[nx-ix-1][3] * v[nx-4, iy, iz] +
        __Pyx_TraceLine(545,0,__PYX_ERR(0, 545, __pyx_L1_error))
        __pyx_t_22 = (__pyx_v_nx - 4);
        __pyx_t_23 = __pyx_v_iy;
        __pyx_t_24 = __pyx_v_iz;
+546:                                     a11d[nx-ix-1][4] * v[nx-5, iy, iz] +
        __Pyx_TraceLine(546,0,__PYX_ERR(0, 546, __pyx_L1_error))
        __pyx_t_25 = (__pyx_v_nx - 5);
        __pyx_t_26 = __pyx_v_iy;
        __pyx_t_27 = __pyx_v_iz;
+547:                                     a11d[nx-ix-1][5] * v[nx-6, iy, iz] +
        __Pyx_TraceLine(547,0,__PYX_ERR(0, 547, __pyx_L1_error))
        __pyx_t_28 = (__pyx_v_nx - 6);
        __pyx_t_29 = __pyx_v_iy;
        __pyx_t_30 = __pyx_v_iz;
+548:                                     a11d[nx-ix-1][6] * v[nx-7, iy, iz] +
        __Pyx_TraceLine(548,0,__PYX_ERR(0, 548, __pyx_L1_error))
        __pyx_t_31 = (__pyx_v_nx - 7);
        __pyx_t_32 = __pyx_v_iy;
        __pyx_t_33 = __pyx_v_iz;
+549:                                     a11d[nx-ix-1][7] * v[nx-8, iy, iz] +
        __Pyx_TraceLine(549,0,__PYX_ERR(0, 549, __pyx_L1_error))
        __pyx_t_34 = (__pyx_v_nx - 8);
        __pyx_t_35 = __pyx_v_iy;
        __pyx_t_36 = __pyx_v_iz;
+550:                                     a11d[nx-ix-1][8] * v[nx-9, iy, iz] +
        __Pyx_TraceLine(550,0,__PYX_ERR(0, 550, __pyx_L1_error))
        __pyx_t_37 = (__pyx_v_nx - 9);
        __pyx_t_38 = __pyx_v_iy;
        __pyx_t_39 = __pyx_v_iz;
+551:                                     a11d[nx-ix-1][9] * v[nx-10, iy, iz] +
        __Pyx_TraceLine(551,0,__PYX_ERR(0, 551, __pyx_L1_error))
        __pyx_t_40 = (__pyx_v_nx - 10);
        __pyx_t_41 = __pyx_v_iy;
        __pyx_t_42 = __pyx_v_iz;
+552:                                     a11d[nx-ix-1][10] * v[nx-11, iy, iz]) * odx
        __Pyx_TraceLine(552,0,__PYX_ERR(0, 552, __pyx_L1_error))
        __pyx_t_43 = (__pyx_v_nx - 11);
        __pyx_t_44 = __pyx_v_iy;
        __pyx_t_45 = __pyx_v_iz;
 553: 
+554:     return dv
  __Pyx_TraceLine(554,0,__PYX_ERR(0, 554, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_dv, 1);
  __pyx_r = __pyx_v_dv;
  goto __pyx_L0;
 555: 
 556: 
+557: cdef double[:, :, ::1] _du3d_y(double[:, :, ::1] v, double dy = 1.):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths__du3d_y(__Pyx_memviewslice __pyx_v_v, struct __pyx_opt_args_6libfds_6cmaths__du3d_y *__pyx_optional_args) {
  double __pyx_v_dy = ((double)1.);
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  double __pyx_v_ody;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  __Pyx_memviewslice __pyx_v_dv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_du3d_y", __pyx_f[0], 557, 0, __PYX_ERR(0, 557, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_dy = __pyx_optional_args->dy;
    }
  }
/* … */
  /* 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_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths._du3d_y", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dv, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(557,0,__PYX_ERR(0, 557, __pyx_L1_error))

 558: 
 559:     cdef Py_ssize_t ix, iy, iz
+560:     cdef double ody = 1. / dy
  __Pyx_TraceLine(560,0,__PYX_ERR(0, 560, __pyx_L1_error))
  __pyx_v_ody = (1. / __pyx_v_dy);
+561:     cdef Py_ssize_t nx = v.shape[0]
  __Pyx_TraceLine(561,0,__PYX_ERR(0, 561, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_v.shape[0]);
+562:     cdef Py_ssize_t ny = v.shape[1]
  __Pyx_TraceLine(562,0,__PYX_ERR(0, 562, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_v.shape[1]);
+563:     cdef Py_ssize_t nz = v.shape[2]
  __Pyx_TraceLine(563,0,__PYX_ERR(0, 563, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_v.shape[2]);
+564:     cdef double[:, :, ::1] dv = np.zeros_like(v)
  __Pyx_TraceLine(564,0,__PYX_ERR(0, 564, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_v, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 565: 
+566:     for ix in range(nx):
  __Pyx_TraceLine(566,0,__PYX_ERR(0, 566, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+567:         for iy in range(5, ny - 5):
    __Pyx_TraceLine(567,0,__PYX_ERR(0, 567, __pyx_L1_error))
    __pyx_t_10 = (__pyx_v_ny - 5);
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 5; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+568:             for iz in range(nz):
      __Pyx_TraceLine(568,0,__PYX_ERR(0, 568, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_nz;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_iz = __pyx_t_15;
+569:                 dv[ix, iy, iz] = (a11c[1] * (v[ix, iy+1, iz] - v[ix, iy-1, iz]) +
        __Pyx_TraceLine(569,0,__PYX_ERR(0, 569, __pyx_L1_error))
        __pyx_t_16 = __pyx_v_ix;
        __pyx_t_17 = (__pyx_v_iy + 1);
        __pyx_t_18 = __pyx_v_iz;
        __pyx_t_19 = __pyx_v_ix;
        __pyx_t_20 = (__pyx_v_iy - 1);
        __pyx_t_21 = __pyx_v_iz;
/* … */
        __Pyx_TraceLine(569,0,__PYX_ERR(0, 569, __pyx_L1_error))
        __pyx_t_46 = __pyx_v_ix;
        __pyx_t_47 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_46 * __pyx_v_dv.strides[0]) ) + __pyx_t_47 * __pyx_v_dv.strides[1]) )) + __pyx_t_48)) )) = (((((((a11c[1]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_16 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_18)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_21)) ))))) + ((a11c[2]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_24)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_27)) )))))) + ((a11c[3]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_28 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_30)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_33)) )))))) + ((a11c[4]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_34 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_36)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_37 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_39)) )))))) + ((a11c[5]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_40 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_42)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_43 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_45)) )))))) * __pyx_v_ody);
      }
    }
  }
+570:                                   a11c[2] * (v[ix, iy+2, iz] - v[ix, iy-2, iz]) +
        __Pyx_TraceLine(570,0,__PYX_ERR(0, 570, __pyx_L1_error))
        __pyx_t_22 = __pyx_v_ix;
        __pyx_t_23 = (__pyx_v_iy + 2);
        __pyx_t_24 = __pyx_v_iz;
        __pyx_t_25 = __pyx_v_ix;
        __pyx_t_26 = (__pyx_v_iy - 2);
        __pyx_t_27 = __pyx_v_iz;
+571:                                   a11c[3] * (v[ix, iy+3, iz] - v[ix, iy-3, iz]) +
        __Pyx_TraceLine(571,0,__PYX_ERR(0, 571, __pyx_L1_error))
        __pyx_t_28 = __pyx_v_ix;
        __pyx_t_29 = (__pyx_v_iy + 3);
        __pyx_t_30 = __pyx_v_iz;
        __pyx_t_31 = __pyx_v_ix;
        __pyx_t_32 = (__pyx_v_iy - 3);
        __pyx_t_33 = __pyx_v_iz;
+572:                                   a11c[4] * (v[ix, iy+4, iz] - v[ix, iy-4, iz]) +
        __Pyx_TraceLine(572,0,__PYX_ERR(0, 572, __pyx_L1_error))
        __pyx_t_34 = __pyx_v_ix;
        __pyx_t_35 = (__pyx_v_iy + 4);
        __pyx_t_36 = __pyx_v_iz;
        __pyx_t_37 = __pyx_v_ix;
        __pyx_t_38 = (__pyx_v_iy - 4);
        __pyx_t_39 = __pyx_v_iz;
+573:                                   a11c[5] * (v[ix, iy+5, iz] - v[ix, iy-5, iz])) * ody
        __Pyx_TraceLine(573,0,__PYX_ERR(0, 573, __pyx_L1_error))
        __pyx_t_40 = __pyx_v_ix;
        __pyx_t_41 = (__pyx_v_iy + 5);
        __pyx_t_42 = __pyx_v_iz;
        __pyx_t_43 = __pyx_v_ix;
        __pyx_t_44 = (__pyx_v_iy - 5);
        __pyx_t_45 = __pyx_v_iz;
 574: 
+575:     for ix in range(nx):
  __Pyx_TraceLine(575,0,__PYX_ERR(0, 575, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+576:         for iy in range(0, 5):
    __Pyx_TraceLine(576,0,__PYX_ERR(0, 576, __pyx_L1_error))
    for (__pyx_t_10 = 0; __pyx_t_10 < 5; __pyx_t_10+=1) {
      __pyx_v_iy = __pyx_t_10;
+577:             for iz in range(nz):
      __Pyx_TraceLine(577,0,__PYX_ERR(0, 577, __pyx_L1_error))
      __pyx_t_11 = __pyx_v_nz;
      __pyx_t_12 = __pyx_t_11;
      for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
        __pyx_v_iz = __pyx_t_13;
+578:                 dv[ix, iy, iz] = (a11d[iy][0] * v[ix, 0, iz] +
        __Pyx_TraceLine(578,0,__PYX_ERR(0, 578, __pyx_L1_error))
        __pyx_t_45 = __pyx_v_ix;
        __pyx_t_44 = 0;
        __pyx_t_43 = __pyx_v_iz;
/* … */
        __Pyx_TraceLine(578,0,__PYX_ERR(0, 578, __pyx_L1_error))
        __pyx_t_49 = __pyx_v_ix;
        __pyx_t_50 = __pyx_v_iy;
        __pyx_t_51 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_49 * __pyx_v_dv.strides[0]) ) + __pyx_t_50 * __pyx_v_dv.strides[1]) )) + __pyx_t_51)) )) = ((((((((((((((a11d[__pyx_v_iy])[0]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_45 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_43)) )))) + (((a11d[__pyx_v_iy])[1]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_42 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_40)) ))))) + (((a11d[__pyx_v_iy])[2]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_39 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_37)) ))))) + (((a11d[__pyx_v_iy])[3]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_36 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_34)) ))))) + (((a11d[__pyx_v_iy])[4]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_33 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_31)) ))))) + (((a11d[__pyx_v_iy])[5]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_30 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_28)) ))))) + (((a11d[__pyx_v_iy])[6]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_27 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_25)) ))))) + (((a11d[__pyx_v_iy])[7]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_24 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_22)) ))))) + (((a11d[__pyx_v_iy])[8]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_19)) ))))) + (((a11d[__pyx_v_iy])[9]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_18 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_16)) ))))) + (((a11d[__pyx_v_iy])[10]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_48 * __pyx_v_v.strides[0]) ) + __pyx_t_47 * __pyx_v_v.strides[1]) )) + __pyx_t_46)) ))))) * __pyx_v_ody);
      }
    }
  }
+579:                                   a11d[iy][1] * v[ix, 1, iz] +
        __Pyx_TraceLine(579,0,__PYX_ERR(0, 579, __pyx_L1_error))
        __pyx_t_42 = __pyx_v_ix;
        __pyx_t_41 = 1;
        __pyx_t_40 = __pyx_v_iz;
+580:                                   a11d[iy][2] * v[ix, 2, iz] +
        __Pyx_TraceLine(580,0,__PYX_ERR(0, 580, __pyx_L1_error))
        __pyx_t_39 = __pyx_v_ix;
        __pyx_t_38 = 2;
        __pyx_t_37 = __pyx_v_iz;
+581:                                   a11d[iy][3] * v[ix, 3, iz] +
        __Pyx_TraceLine(581,0,__PYX_ERR(0, 581, __pyx_L1_error))
        __pyx_t_36 = __pyx_v_ix;
        __pyx_t_35 = 3;
        __pyx_t_34 = __pyx_v_iz;
+582:                                   a11d[iy][4] * v[ix, 4, iz] +
        __Pyx_TraceLine(582,0,__PYX_ERR(0, 582, __pyx_L1_error))
        __pyx_t_33 = __pyx_v_ix;
        __pyx_t_32 = 4;
        __pyx_t_31 = __pyx_v_iz;
+583:                                   a11d[iy][5] * v[ix, 5, iz] +
        __Pyx_TraceLine(583,0,__PYX_ERR(0, 583, __pyx_L1_error))
        __pyx_t_30 = __pyx_v_ix;
        __pyx_t_29 = 5;
        __pyx_t_28 = __pyx_v_iz;
+584:                                   a11d[iy][6] * v[ix, 6, iz] +
        __Pyx_TraceLine(584,0,__PYX_ERR(0, 584, __pyx_L1_error))
        __pyx_t_27 = __pyx_v_ix;
        __pyx_t_26 = 6;
        __pyx_t_25 = __pyx_v_iz;
+585:                                   a11d[iy][7] * v[ix, 7, iz] +
        __Pyx_TraceLine(585,0,__PYX_ERR(0, 585, __pyx_L1_error))
        __pyx_t_24 = __pyx_v_ix;
        __pyx_t_23 = 7;
        __pyx_t_22 = __pyx_v_iz;
+586:                                   a11d[iy][8] * v[ix, 8, iz] +
        __Pyx_TraceLine(586,0,__PYX_ERR(0, 586, __pyx_L1_error))
        __pyx_t_21 = __pyx_v_ix;
        __pyx_t_20 = 8;
        __pyx_t_19 = __pyx_v_iz;
+587:                                   a11d[iy][9] * v[ix, 9, iz] +
        __Pyx_TraceLine(587,0,__PYX_ERR(0, 587, __pyx_L1_error))
        __pyx_t_18 = __pyx_v_ix;
        __pyx_t_17 = 9;
        __pyx_t_16 = __pyx_v_iz;
+588:                                   a11d[iy][10] * v[ix, 10, iz]) * ody
        __Pyx_TraceLine(588,0,__PYX_ERR(0, 588, __pyx_L1_error))
        __pyx_t_48 = __pyx_v_ix;
        __pyx_t_47 = 10;
        __pyx_t_46 = __pyx_v_iz;
 589: 
+590:     for ix in range(nx):
  __Pyx_TraceLine(590,0,__PYX_ERR(0, 590, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+591:         for iy in range(ny-1, ny-6, -1):
    __Pyx_TraceLine(591,0,__PYX_ERR(0, 591, __pyx_L1_error))
    __pyx_t_10 = (__pyx_v_ny - 6);
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = (__pyx_v_ny - 1); __pyx_t_12 > __pyx_t_11; __pyx_t_12-=1) {
      __pyx_v_iy = __pyx_t_12;
+592:             for iz in range(nz):
      __Pyx_TraceLine(592,0,__PYX_ERR(0, 592, __pyx_L1_error))
      __pyx_t_13 = __pyx_v_nz;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_iz = __pyx_t_15;
+593:                 dv[ix, iy, iz] = - (a11d[ny-iy-1][0] * v[ix, ny-1, iz] +
        __Pyx_TraceLine(593,0,__PYX_ERR(0, 593, __pyx_L1_error))
        __pyx_t_46 = __pyx_v_ix;
        __pyx_t_47 = (__pyx_v_ny - 1);
        __pyx_t_48 = __pyx_v_iz;
/* … */
        __Pyx_TraceLine(593,0,__PYX_ERR(0, 593, __pyx_L1_error))
        __pyx_t_51 = __pyx_v_ix;
        __pyx_t_50 = __pyx_v_iy;
        __pyx_t_49 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_51 * __pyx_v_dv.strides[0]) ) + __pyx_t_50 * __pyx_v_dv.strides[1]) )) + __pyx_t_49)) )) = ((-(((((((((((((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[0]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_46 * __pyx_v_v.strides[0]) ) + __pyx_t_47 * __pyx_v_v.strides[1]) )) + __pyx_t_48)) )))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[1]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_16 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_18)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[2]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_21)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[3]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_24)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[4]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_27)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[5]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_28 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_30)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[6]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_33)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[7]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_34 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_36)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[8]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_37 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_39)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[9]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_40 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_42)) ))))) + (((a11d[((__pyx_v_ny - __pyx_v_iy) - 1)])[10]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_43 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_45)) )))))) * __pyx_v_ody);
      }
    }
  }
+594:                                     a11d[ny-iy-1][1] * v[ix, ny-2, iz] +
        __Pyx_TraceLine(594,0,__PYX_ERR(0, 594, __pyx_L1_error))
        __pyx_t_16 = __pyx_v_ix;
        __pyx_t_17 = (__pyx_v_ny - 2);
        __pyx_t_18 = __pyx_v_iz;
+595:                                     a11d[ny-iy-1][2] * v[ix, ny-3, iz] +
        __Pyx_TraceLine(595,0,__PYX_ERR(0, 595, __pyx_L1_error))
        __pyx_t_19 = __pyx_v_ix;
        __pyx_t_20 = (__pyx_v_ny - 3);
        __pyx_t_21 = __pyx_v_iz;
+596:                                     a11d[ny-iy-1][3] * v[ix, ny-4, iz] +
        __Pyx_TraceLine(596,0,__PYX_ERR(0, 596, __pyx_L1_error))
        __pyx_t_22 = __pyx_v_ix;
        __pyx_t_23 = (__pyx_v_ny - 4);
        __pyx_t_24 = __pyx_v_iz;
+597:                                     a11d[ny-iy-1][4] * v[ix, ny-5, iz] +
        __Pyx_TraceLine(597,0,__PYX_ERR(0, 597, __pyx_L1_error))
        __pyx_t_25 = __pyx_v_ix;
        __pyx_t_26 = (__pyx_v_ny - 5);
        __pyx_t_27 = __pyx_v_iz;
+598:                                     a11d[ny-iy-1][5] * v[ix, ny-6, iz] +
        __Pyx_TraceLine(598,0,__PYX_ERR(0, 598, __pyx_L1_error))
        __pyx_t_28 = __pyx_v_ix;
        __pyx_t_29 = (__pyx_v_ny - 6);
        __pyx_t_30 = __pyx_v_iz;
+599:                                     a11d[ny-iy-1][6] * v[ix, ny-7, iz] +
        __Pyx_TraceLine(599,0,__PYX_ERR(0, 599, __pyx_L1_error))
        __pyx_t_31 = __pyx_v_ix;
        __pyx_t_32 = (__pyx_v_ny - 7);
        __pyx_t_33 = __pyx_v_iz;
+600:                                     a11d[ny-iy-1][7] * v[ix, ny-8, iz] +
        __Pyx_TraceLine(600,0,__PYX_ERR(0, 600, __pyx_L1_error))
        __pyx_t_34 = __pyx_v_ix;
        __pyx_t_35 = (__pyx_v_ny - 8);
        __pyx_t_36 = __pyx_v_iz;
+601:                                     a11d[ny-iy-1][8] * v[ix, ny-9, iz] +
        __Pyx_TraceLine(601,0,__PYX_ERR(0, 601, __pyx_L1_error))
        __pyx_t_37 = __pyx_v_ix;
        __pyx_t_38 = (__pyx_v_ny - 9);
        __pyx_t_39 = __pyx_v_iz;
+602:                                     a11d[ny-iy-1][9] * v[ix, ny-10, iz] +
        __Pyx_TraceLine(602,0,__PYX_ERR(0, 602, __pyx_L1_error))
        __pyx_t_40 = __pyx_v_ix;
        __pyx_t_41 = (__pyx_v_ny - 10);
        __pyx_t_42 = __pyx_v_iz;
+603:                                     a11d[ny-iy-1][10] * v[ix, ny-11, iz]) * ody
        __Pyx_TraceLine(603,0,__PYX_ERR(0, 603, __pyx_L1_error))
        __pyx_t_43 = __pyx_v_ix;
        __pyx_t_44 = (__pyx_v_ny - 11);
        __pyx_t_45 = __pyx_v_iz;
 604: 
+605:     return dv
  __Pyx_TraceLine(605,0,__PYX_ERR(0, 605, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_dv, 1);
  __pyx_r = __pyx_v_dv;
  goto __pyx_L0;
 606: 
 607: 
+608: cdef double[:, :, ::1] _du3d_z(double[:, :, ::1] v, double dz = 1.):
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths__du3d_z(__Pyx_memviewslice __pyx_v_v, struct __pyx_opt_args_6libfds_6cmaths__du3d_z *__pyx_optional_args) {
  double __pyx_v_dz = ((double)1.);
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  double __pyx_v_odz;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  __Pyx_memviewslice __pyx_v_dv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_du3d_z", __pyx_f[0], 608, 0, __PYX_ERR(0, 608, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_dz = __pyx_optional_args->dz;
    }
  }
/* … */
  /* 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_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths._du3d_z", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_dv, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(608,0,__PYX_ERR(0, 608, __pyx_L1_error))

 609: 
 610:     cdef Py_ssize_t ix, iy, iz
+611:     cdef double odz = 1. / dz
  __Pyx_TraceLine(611,0,__PYX_ERR(0, 611, __pyx_L1_error))
  __pyx_v_odz = (1. / __pyx_v_dz);
+612:     cdef Py_ssize_t nx = v.shape[0]
  __Pyx_TraceLine(612,0,__PYX_ERR(0, 612, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_v.shape[0]);
+613:     cdef Py_ssize_t ny = v.shape[1]
  __Pyx_TraceLine(613,0,__PYX_ERR(0, 613, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_v.shape[1]);
+614:     cdef Py_ssize_t nz = v.shape[2]
  __Pyx_TraceLine(614,0,__PYX_ERR(0, 614, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_v.shape[2]);
+615:     cdef double[:, :, ::1] dv = np.zeros_like(v)
  __Pyx_TraceLine(615,0,__PYX_ERR(0, 615, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_v, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
 616: 
+617:     for ix in range(nx):
  __Pyx_TraceLine(617,0,__PYX_ERR(0, 617, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+618:         for iy in range(ny):
    __Pyx_TraceLine(618,0,__PYX_ERR(0, 618, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+619:             for iz in range(5, nz - 5):
      __Pyx_TraceLine(619,0,__PYX_ERR(0, 619, __pyx_L1_error))
      __pyx_t_13 = (__pyx_v_nz - 5);
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 5; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_iz = __pyx_t_15;
+620:                 dv[ix, iy, iz] = (a11c[1] * (v[ix, iy, iz+1] - v[ix, iy, iz-1]) +
        __Pyx_TraceLine(620,0,__PYX_ERR(0, 620, __pyx_L1_error))
        __pyx_t_16 = __pyx_v_ix;
        __pyx_t_17 = __pyx_v_iy;
        __pyx_t_18 = (__pyx_v_iz + 1);
        __pyx_t_19 = __pyx_v_ix;
        __pyx_t_20 = __pyx_v_iy;
        __pyx_t_21 = (__pyx_v_iz - 1);
/* … */
        __Pyx_TraceLine(620,0,__PYX_ERR(0, 620, __pyx_L1_error))
        __pyx_t_46 = __pyx_v_ix;
        __pyx_t_47 = __pyx_v_iy;
        __pyx_t_48 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_46 * __pyx_v_dv.strides[0]) ) + __pyx_t_47 * __pyx_v_dv.strides[1]) )) + __pyx_t_48)) )) = (((((((a11c[1]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_16 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_18)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_21)) ))))) + ((a11c[2]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_24)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_27)) )))))) + ((a11c[3]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_28 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_30)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_33)) )))))) + ((a11c[4]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_34 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_36)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_37 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_39)) )))))) + ((a11c[5]) * ((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_40 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_42)) ))) - (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_43 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_45)) )))))) * __pyx_v_odz);
      }
    }
  }
+621:                                   a11c[2] * (v[ix, iy, iz+2] - v[ix, iy, iz-2]) +
        __Pyx_TraceLine(621,0,__PYX_ERR(0, 621, __pyx_L1_error))
        __pyx_t_22 = __pyx_v_ix;
        __pyx_t_23 = __pyx_v_iy;
        __pyx_t_24 = (__pyx_v_iz + 2);
        __pyx_t_25 = __pyx_v_ix;
        __pyx_t_26 = __pyx_v_iy;
        __pyx_t_27 = (__pyx_v_iz - 2);
+622:                                   a11c[3] * (v[ix, iy, iz+3] - v[ix, iy, iz-3]) +
        __Pyx_TraceLine(622,0,__PYX_ERR(0, 622, __pyx_L1_error))
        __pyx_t_28 = __pyx_v_ix;
        __pyx_t_29 = __pyx_v_iy;
        __pyx_t_30 = (__pyx_v_iz + 3);
        __pyx_t_31 = __pyx_v_ix;
        __pyx_t_32 = __pyx_v_iy;
        __pyx_t_33 = (__pyx_v_iz - 3);
+623:                                   a11c[4] * (v[ix, iy, iz+4] - v[ix, iy, iz-4]) +
        __Pyx_TraceLine(623,0,__PYX_ERR(0, 623, __pyx_L1_error))
        __pyx_t_34 = __pyx_v_ix;
        __pyx_t_35 = __pyx_v_iy;
        __pyx_t_36 = (__pyx_v_iz + 4);
        __pyx_t_37 = __pyx_v_ix;
        __pyx_t_38 = __pyx_v_iy;
        __pyx_t_39 = (__pyx_v_iz - 4);
+624:                                   a11c[5] * (v[ix, iy, iz+5] - v[ix, iy, iz-5])) * odz
        __Pyx_TraceLine(624,0,__PYX_ERR(0, 624, __pyx_L1_error))
        __pyx_t_40 = __pyx_v_ix;
        __pyx_t_41 = __pyx_v_iy;
        __pyx_t_42 = (__pyx_v_iz + 5);
        __pyx_t_43 = __pyx_v_ix;
        __pyx_t_44 = __pyx_v_iy;
        __pyx_t_45 = (__pyx_v_iz - 5);
 625: 
+626:     for ix in range(nx):
  __Pyx_TraceLine(626,0,__PYX_ERR(0, 626, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+627:         for iy in range(ny):
    __Pyx_TraceLine(627,0,__PYX_ERR(0, 627, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+628:             for iz in range(0, 5):
      __Pyx_TraceLine(628,0,__PYX_ERR(0, 628, __pyx_L1_error))
      for (__pyx_t_13 = 0; __pyx_t_13 < 5; __pyx_t_13+=1) {
        __pyx_v_iz = __pyx_t_13;
+629:                 dv[ix, iy, iz] = (a11d[iz][0] * v[ix, iz, 0] +
        __Pyx_TraceLine(629,0,__PYX_ERR(0, 629, __pyx_L1_error))
        __pyx_t_45 = __pyx_v_ix;
        __pyx_t_44 = __pyx_v_iz;
        __pyx_t_43 = 0;
/* … */
        __Pyx_TraceLine(629,0,__PYX_ERR(0, 629, __pyx_L1_error))
        __pyx_t_49 = __pyx_v_ix;
        __pyx_t_50 = __pyx_v_iy;
        __pyx_t_51 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_49 * __pyx_v_dv.strides[0]) ) + __pyx_t_50 * __pyx_v_dv.strides[1]) )) + __pyx_t_51)) )) = ((((((((((((((a11d[__pyx_v_iz])[0]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_45 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_43)) )))) + (((a11d[__pyx_v_iz])[1]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_42 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_40)) ))))) + (((a11d[__pyx_v_iz])[2]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_39 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_37)) ))))) + (((a11d[__pyx_v_iz])[3]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_36 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_34)) ))))) + (((a11d[__pyx_v_iz])[4]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_33 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_31)) ))))) + (((a11d[__pyx_v_iz])[5]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_30 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_28)) ))))) + (((a11d[__pyx_v_iz])[6]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_27 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_25)) ))))) + (((a11d[__pyx_v_iz])[7]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_24 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_22)) ))))) + (((a11d[__pyx_v_iz])[8]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_19)) ))))) + (((a11d[__pyx_v_iz])[9]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_18 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_16)) ))))) + (((a11d[__pyx_v_iz])[10]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_48 * __pyx_v_v.strides[0]) ) + __pyx_t_47 * __pyx_v_v.strides[1]) )) + __pyx_t_46)) ))))) * __pyx_v_odz);
      }
    }
  }
+630:                                   a11d[iz][1] * v[ix, iz, 1] +
        __Pyx_TraceLine(630,0,__PYX_ERR(0, 630, __pyx_L1_error))
        __pyx_t_42 = __pyx_v_ix;
        __pyx_t_41 = __pyx_v_iz;
        __pyx_t_40 = 1;
+631:                                   a11d[iz][2] * v[ix, iz, 2] +
        __Pyx_TraceLine(631,0,__PYX_ERR(0, 631, __pyx_L1_error))
        __pyx_t_39 = __pyx_v_ix;
        __pyx_t_38 = __pyx_v_iz;
        __pyx_t_37 = 2;
+632:                                   a11d[iz][3] * v[ix, iz, 3] +
        __Pyx_TraceLine(632,0,__PYX_ERR(0, 632, __pyx_L1_error))
        __pyx_t_36 = __pyx_v_ix;
        __pyx_t_35 = __pyx_v_iz;
        __pyx_t_34 = 3;
+633:                                   a11d[iz][4] * v[ix, iz, 4] +
        __Pyx_TraceLine(633,0,__PYX_ERR(0, 633, __pyx_L1_error))
        __pyx_t_33 = __pyx_v_ix;
        __pyx_t_32 = __pyx_v_iz;
        __pyx_t_31 = 4;
+634:                                   a11d[iz][5] * v[ix, iz, 5] +
        __Pyx_TraceLine(634,0,__PYX_ERR(0, 634, __pyx_L1_error))
        __pyx_t_30 = __pyx_v_ix;
        __pyx_t_29 = __pyx_v_iz;
        __pyx_t_28 = 5;
+635:                                   a11d[iz][6] * v[ix, iz, 6] +
        __Pyx_TraceLine(635,0,__PYX_ERR(0, 635, __pyx_L1_error))
        __pyx_t_27 = __pyx_v_ix;
        __pyx_t_26 = __pyx_v_iz;
        __pyx_t_25 = 6;
+636:                                   a11d[iz][7] * v[ix, iz, 7] +
        __Pyx_TraceLine(636,0,__PYX_ERR(0, 636, __pyx_L1_error))
        __pyx_t_24 = __pyx_v_ix;
        __pyx_t_23 = __pyx_v_iz;
        __pyx_t_22 = 7;
+637:                                   a11d[iz][8] * v[ix, iz, 8] +
        __Pyx_TraceLine(637,0,__PYX_ERR(0, 637, __pyx_L1_error))
        __pyx_t_21 = __pyx_v_ix;
        __pyx_t_20 = __pyx_v_iz;
        __pyx_t_19 = 8;
+638:                                   a11d[iz][9] * v[ix, iz, 9] +
        __Pyx_TraceLine(638,0,__PYX_ERR(0, 638, __pyx_L1_error))
        __pyx_t_18 = __pyx_v_ix;
        __pyx_t_17 = __pyx_v_iz;
        __pyx_t_16 = 9;
+639:                                   a11d[iz][10] * v[ix, iz, 10]) * odz
        __Pyx_TraceLine(639,0,__PYX_ERR(0, 639, __pyx_L1_error))
        __pyx_t_48 = __pyx_v_ix;
        __pyx_t_47 = __pyx_v_iz;
        __pyx_t_46 = 10;
 640: 
+641:     for ix in range(nx):
  __Pyx_TraceLine(641,0,__PYX_ERR(0, 641, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_nx;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_ix = __pyx_t_9;
+642:         for iy in range(ny):
    __Pyx_TraceLine(642,0,__PYX_ERR(0, 642, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_ny;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_iy = __pyx_t_12;
+643:             for iz in range(nz-1, nz-6, -1):
      __Pyx_TraceLine(643,0,__PYX_ERR(0, 643, __pyx_L1_error))
      __pyx_t_13 = (__pyx_v_nz - 6);
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = (__pyx_v_nz - 1); __pyx_t_15 > __pyx_t_14; __pyx_t_15-=1) {
        __pyx_v_iz = __pyx_t_15;
+644:                 dv[ix, iy, iz] = - (a11d[nz-iz-1][0] * v[ix, iy, nz-1] +
        __Pyx_TraceLine(644,0,__PYX_ERR(0, 644, __pyx_L1_error))
        __pyx_t_46 = __pyx_v_ix;
        __pyx_t_47 = __pyx_v_iy;
        __pyx_t_48 = (__pyx_v_nz - 1);
/* … */
        __Pyx_TraceLine(644,0,__PYX_ERR(0, 644, __pyx_L1_error))
        __pyx_t_51 = __pyx_v_ix;
        __pyx_t_50 = __pyx_v_iy;
        __pyx_t_49 = __pyx_v_iz;
        *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dv.data + __pyx_t_51 * __pyx_v_dv.strides[0]) ) + __pyx_t_50 * __pyx_v_dv.strides[1]) )) + __pyx_t_49)) )) = ((-(((((((((((((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[0]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_46 * __pyx_v_v.strides[0]) ) + __pyx_t_47 * __pyx_v_v.strides[1]) )) + __pyx_t_48)) )))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[1]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_16 * __pyx_v_v.strides[0]) ) + __pyx_t_17 * __pyx_v_v.strides[1]) )) + __pyx_t_18)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[2]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_19 * __pyx_v_v.strides[0]) ) + __pyx_t_20 * __pyx_v_v.strides[1]) )) + __pyx_t_21)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[3]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) ) + __pyx_t_23 * __pyx_v_v.strides[1]) )) + __pyx_t_24)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[4]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_25 * __pyx_v_v.strides[0]) ) + __pyx_t_26 * __pyx_v_v.strides[1]) )) + __pyx_t_27)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[5]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_28 * __pyx_v_v.strides[0]) ) + __pyx_t_29 * __pyx_v_v.strides[1]) )) + __pyx_t_30)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[6]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_31 * __pyx_v_v.strides[0]) ) + __pyx_t_32 * __pyx_v_v.strides[1]) )) + __pyx_t_33)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[7]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_34 * __pyx_v_v.strides[0]) ) + __pyx_t_35 * __pyx_v_v.strides[1]) )) + __pyx_t_36)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[8]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_37 * __pyx_v_v.strides[0]) ) + __pyx_t_38 * __pyx_v_v.strides[1]) )) + __pyx_t_39)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[9]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_40 * __pyx_v_v.strides[0]) ) + __pyx_t_41 * __pyx_v_v.strides[1]) )) + __pyx_t_42)) ))))) + (((a11d[((__pyx_v_nz - __pyx_v_iz) - 1)])[10]) * (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_v.data + __pyx_t_43 * __pyx_v_v.strides[0]) ) + __pyx_t_44 * __pyx_v_v.strides[1]) )) + __pyx_t_45)) )))))) * __pyx_v_odz);
      }
    }
  }
+645:                                     a11d[nz-iz-1][1] * v[ix, iy, nz-2] +
        __Pyx_TraceLine(645,0,__PYX_ERR(0, 645, __pyx_L1_error))
        __pyx_t_16 = __pyx_v_ix;
        __pyx_t_17 = __pyx_v_iy;
        __pyx_t_18 = (__pyx_v_nz - 2);
+646:                                     a11d[nz-iz-1][2] * v[ix, iy, nz-3] +
        __Pyx_TraceLine(646,0,__PYX_ERR(0, 646, __pyx_L1_error))
        __pyx_t_19 = __pyx_v_ix;
        __pyx_t_20 = __pyx_v_iy;
        __pyx_t_21 = (__pyx_v_nz - 3);
+647:                                     a11d[nz-iz-1][3] * v[ix, iy, nz-4] +
        __Pyx_TraceLine(647,0,__PYX_ERR(0, 647, __pyx_L1_error))
        __pyx_t_22 = __pyx_v_ix;
        __pyx_t_23 = __pyx_v_iy;
        __pyx_t_24 = (__pyx_v_nz - 4);
+648:                                     a11d[nz-iz-1][4] * v[ix, iy, nz-5] +
        __Pyx_TraceLine(648,0,__PYX_ERR(0, 648, __pyx_L1_error))
        __pyx_t_25 = __pyx_v_ix;
        __pyx_t_26 = __pyx_v_iy;
        __pyx_t_27 = (__pyx_v_nz - 5);
+649:                                     a11d[nz-iz-1][5] * v[ix, iy, nz-6] +
        __Pyx_TraceLine(649,0,__PYX_ERR(0, 649, __pyx_L1_error))
        __pyx_t_28 = __pyx_v_ix;
        __pyx_t_29 = __pyx_v_iy;
        __pyx_t_30 = (__pyx_v_nz - 6);
+650:                                     a11d[nz-iz-1][6] * v[ix, iy, nz-7] +
        __Pyx_TraceLine(650,0,__PYX_ERR(0, 650, __pyx_L1_error))
        __pyx_t_31 = __pyx_v_ix;
        __pyx_t_32 = __pyx_v_iy;
        __pyx_t_33 = (__pyx_v_nz - 7);
+651:                                     a11d[nz-iz-1][7] * v[ix, iy, nz-8] +
        __Pyx_TraceLine(651,0,__PYX_ERR(0, 651, __pyx_L1_error))
        __pyx_t_34 = __pyx_v_ix;
        __pyx_t_35 = __pyx_v_iy;
        __pyx_t_36 = (__pyx_v_nz - 8);
+652:                                     a11d[nz-iz-1][8] * v[ix, iy, nz-9] +
        __Pyx_TraceLine(652,0,__PYX_ERR(0, 652, __pyx_L1_error))
        __pyx_t_37 = __pyx_v_ix;
        __pyx_t_38 = __pyx_v_iy;
        __pyx_t_39 = (__pyx_v_nz - 9);
+653:                                     a11d[nz-iz-1][9] * v[ix, iy, nz-10] +
        __Pyx_TraceLine(653,0,__PYX_ERR(0, 653, __pyx_L1_error))
        __pyx_t_40 = __pyx_v_ix;
        __pyx_t_41 = __pyx_v_iy;
        __pyx_t_42 = (__pyx_v_nz - 10);
+654:                                     a11d[nz-iz-1][10] * v[ix, iy, nz-11]) * odz
        __Pyx_TraceLine(654,0,__PYX_ERR(0, 654, __pyx_L1_error))
        __pyx_t_43 = __pyx_v_ix;
        __pyx_t_44 = __pyx_v_iy;
        __pyx_t_45 = (__pyx_v_nz - 11);
+655:     return dv
  __Pyx_TraceLine(655,0,__PYX_ERR(0, 655, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_dv, 1);
  __pyx_r = __pyx_v_dv;
  goto __pyx_L0;
 656: 
 657: 
+658: cpdef double[::1] chunk_mean(double[::1] array, Py_ssize_t chunks):
static PyObject *__pyx_pw_6libfds_6cmaths_25chunk_mean(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_chunk_mean(__Pyx_memviewslice __pyx_v_array, Py_ssize_t __pyx_v_chunks, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __Pyx_memviewslice __pyx_v_mean = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__24)
  __Pyx_TraceCall("chunk_mean", __pyx_f[0], 658, 0, __PYX_ERR(0, 658, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.chunk_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_mean, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_25chunk_mean(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6libfds_6cmaths_24chunk_mean, "Compute mean of each chunk of the array.");
static PyMethodDef __pyx_mdef_6libfds_6cmaths_25chunk_mean = {"chunk_mean", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_25chunk_mean, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6libfds_6cmaths_24chunk_mean};
static PyObject *__pyx_pw_6libfds_6cmaths_25chunk_mean(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_array = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_v_chunks;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chunk_mean (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_array,&__pyx_n_s_chunks,0};
  PyObject* values[2] = {0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_array)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chunks)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("chunk_mean", 1, 2, 2, 1); __PYX_ERR(0, 658, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "chunk_mean") < 0)) __PYX_ERR(0, 658, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
    }
    __pyx_v_array = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_array.memview)) __PYX_ERR(0, 658, __pyx_L3_error)
    __pyx_v_chunks = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_chunks == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chunk_mean", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 658, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_array, 1);
  __Pyx_AddTraceback("libfds.cmaths.chunk_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_24chunk_mean(__pyx_self, __pyx_v_array, __pyx_v_chunks);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_array, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_24chunk_mean(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_array, Py_ssize_t __pyx_v_chunks) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__24)
  __Pyx_TraceCall("chunk_mean (wrapper)", __pyx_f[0], 658, 0, __PYX_ERR(0, 658, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_chunk_mean(__pyx_v_array, __pyx_v_chunks, 0); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 658, __pyx_L1_error)
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("libfds.cmaths.chunk_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(658,0,__PYX_ERR(0, 658, __pyx_L1_error))
/* … */
  __pyx_tuple__52 = PyTuple_Pack(2, __pyx_n_s_array, __pyx_n_s_chunks); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_25chunk_mean, 0, __pyx_n_s_chunk_mean, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_chunk_mean, __pyx_t_7) < 0) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_chunk_mean, 658, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 658, __pyx_L1_error)
 659:     """Compute mean of each chunk of the array."""
 660:     cdef Py_ssize_t i
+661:     cdef Py_ssize_t N = len(array)
  __Pyx_TraceLine(661,0,__PYX_ERR(0, 661, __pyx_L1_error))
  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_array); 
  __pyx_v_N = __pyx_t_1;
+662:     cdef double[::1] mean = np.empty(int(N / chunks))
  __Pyx_TraceLine(662,0,__PYX_ERR(0, 662, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_N / __pyx_v_chunks)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_mean = __pyx_t_7;
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
 663: 
+664:     for i in range(N):
  __Pyx_TraceLine(664,0,__PYX_ERR(0, 664, __pyx_L1_error))
  __pyx_t_1 = __pyx_v_N;
  __pyx_t_8 = __pyx_t_1;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;
+665:         mean[i // chunks] += array[i]
    __Pyx_TraceLine(665,0,__PYX_ERR(0, 665, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = (__pyx_v_i / __pyx_v_chunks);
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_mean.data) + __pyx_t_11)) )) += (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_array.data) + __pyx_t_10)) )));
+666:         if not (i+1) % chunks:
    __Pyx_TraceLine(666,0,__PYX_ERR(0, 666, __pyx_L1_error))
    __pyx_t_12 = (!(((__pyx_v_i + 1) % __pyx_v_chunks) != 0));
    if (__pyx_t_12) {
/* … */
    }
  }
+667:             mean[i // chunks] /= chunks
      __Pyx_TraceLine(667,0,__PYX_ERR(0, 667, __pyx_L1_error))
      __pyx_t_10 = (__pyx_v_i / __pyx_v_chunks);
      *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_mean.data) + __pyx_t_10)) )) /= __pyx_v_chunks;
 668: 
+669:     return mean
  __Pyx_TraceLine(669,0,__PYX_ERR(0, 669, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_mean, 1);
  __pyx_r = __pyx_v_mean;
  goto __pyx_L0;
 670: 
 671: 
+672: cpdef nan_check(double[:, ::1] a):
static PyObject *__pyx_pw_6libfds_6cmaths_27nan_check(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_6libfds_6cmaths_nan_check(__Pyx_memviewslice __pyx_v_a, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  int __pyx_v_nx;
  int __pyx_v_ny;
  int __pyx_v_nans;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__25)
  __Pyx_TraceCall("nan_check", __pyx_f[0], 672, 0, __PYX_ERR(0, 672, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("libfds.cmaths.nan_check", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_27nan_check(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6libfds_6cmaths_27nan_check = {"nan_check", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_27nan_check, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6libfds_6cmaths_27nan_check(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  __Pyx_memviewslice __pyx_v_a = { 0, 0, { 0 }, { 0 }, { 0 } };
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nan_check (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,0};
  PyObject* values[1] = {0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 672, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "nan_check") < 0)) __PYX_ERR(0, 672, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
    }
    __pyx_v_a = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_a.memview)) __PYX_ERR(0, 672, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nan_check", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 672, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_a, 1);
  __Pyx_AddTraceback("libfds.cmaths.nan_check", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_26nan_check(__pyx_self, __pyx_v_a);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_a, 1);
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_26nan_check(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__25)
  __Pyx_TraceCall("nan_check (wrapper)", __pyx_f[0], 672, 0, __PYX_ERR(0, 672, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_nan_check(__pyx_v_a, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __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("libfds.cmaths.nan_check", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(672,0,__PYX_ERR(0, 672, __pyx_L1_error))
/* … */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_n_s_a); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_27nan_check, 0, __pyx_n_s_nan_check, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nan_check, __pyx_t_7) < 0) __PYX_ERR(0, 672, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_nan_check, 672, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 672, __pyx_L1_error)
 673: 
 674:     cdef Py_ssize_t i, j
+675:     cdef int nx = a.shape[0]
  __Pyx_TraceLine(675,0,__PYX_ERR(0, 675, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_a.shape[0]);
+676:     cdef int ny = a.shape[1]
  __Pyx_TraceLine(676,0,__PYX_ERR(0, 676, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_a.shape[1]);
+677:     cdef bint nans = False
  __Pyx_TraceLine(677,0,__PYX_ERR(0, 677, __pyx_L1_error))
  __pyx_v_nans = 0;
 678: 
+679:     for i in range(nx):
  __Pyx_TraceLine(679,0,__PYX_ERR(0, 679, __pyx_L1_error))
  __pyx_t_1 = __pyx_v_nx;
  __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;
+680:         for j in range(ny):
    __Pyx_TraceLine(680,0,__PYX_ERR(0, 680, __pyx_L1_error))
    __pyx_t_4 = __pyx_v_ny;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_j = __pyx_t_6;
+681:             if isnan(a[i, j]):
      __Pyx_TraceLine(681,0,__PYX_ERR(0, 681, __pyx_L1_error))
      __pyx_t_7 = __pyx_v_i;
      __pyx_t_8 = __pyx_v_j;
      __pyx_t_9 = isnan((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_a.data + __pyx_t_7 * __pyx_v_a.strides[0]) )) + __pyx_t_8)) ))));
      if (__pyx_t_9) {
/* … */
      }
    }
    __pyx_L6_break:;
+682:                 nans = True
        __Pyx_TraceLine(682,0,__PYX_ERR(0, 682, __pyx_L1_error))
        __pyx_v_nans = 1;
+683:                 break
        __Pyx_TraceLine(683,0,__PYX_ERR(0, 683, __pyx_L1_error))
        goto __pyx_L6_break;
+684:         if nans:
    __Pyx_TraceLine(684,0,__PYX_ERR(0, 684, __pyx_L1_error))
    if (__pyx_v_nans) {
/* … */
    }
  }
  __pyx_L4_break:;
+685:             break
      __Pyx_TraceLine(685,0,__PYX_ERR(0, 685, __pyx_L1_error))
      goto __pyx_L4_break;
+686:     if nans:
  __Pyx_TraceLine(686,0,__PYX_ERR(0, 686, __pyx_L1_error))
  if (__pyx_v_nans) {
/* … */
  }
+687:         return i, j
    __Pyx_TraceLine(687,0,__PYX_ERR(0, 687, __pyx_L1_error))
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_j); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_10);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10)) __PYX_ERR(0, 687, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_11);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11)) __PYX_ERR(0, 687, __pyx_L1_error);
    __pyx_t_10 = 0;
    __pyx_t_11 = 0;
    __pyx_r = __pyx_t_12;
    __pyx_t_12 = 0;
    goto __pyx_L0;
+688:     return None
  __Pyx_TraceLine(688,0,__PYX_ERR(0, 688, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
 689: 
 690: 
+691: cpdef double[:, ::1] super_gaussian2d(x, y, Py_ssize_t ix0, Py_ssize_t iy0,
static PyObject *__pyx_pw_6libfds_6cmaths_29super_gaussian2d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_super_gaussian2d(PyObject *__pyx_v_x, PyObject *__pyx_v_y, Py_ssize_t __pyx_v_ix0, Py_ssize_t __pyx_v_iy0, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6libfds_6cmaths_super_gaussian2d *__pyx_optional_args) {
  double __pyx_v_S0 = ((double)1.0);
  double __pyx_v_kx = ((double)2.0);
  double __pyx_v_ky = ((double)2.0);
  double __pyx_v_k = ((double)1.0);
  double __pyx_v_Bx = ((double)0.1);
  double __pyx_v_By = ((double)0.1);
  double __pyx_v_Rx = ((double)0.0);
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__26)
  __Pyx_TraceCall("super_gaussian2d", __pyx_f[0], 691, 0, __PYX_ERR(0, 691, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_S0 = __pyx_optional_args->S0;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_kx = __pyx_optional_args->kx;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_ky = __pyx_optional_args->ky;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_k = __pyx_optional_args->k;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_Bx = __pyx_optional_args->Bx;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_By = __pyx_optional_args->By;
                if (__pyx_optional_args->__pyx_n > 6) {
                  __pyx_v_Rx = __pyx_optional_args->Rx;
                }
              }
            }
          }
        }
      }
    }
  }
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_29super_gaussian2d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6libfds_6cmaths_28super_gaussian2d, "Super Gaussian distribution.\n\n   .. math::\n\n        sg = e^{- (\\sqrt{(x - x_0)^2 + (y - y_0)^2} + \\sqrt{x_r^2 + y_r^2})^{\\beta} / (B_x \\delta x))^{\\beta}}\n\n    Parameters\n    ----------\n    x, y : numpy.ndarray\n        Axis of the grid.\n    ix0, iy0 : int\n        Indices of the initial position of the pulse :math:`(x_0, y_0)`.\n    S0 : float, optional\n        Amplitude\n    Bx, By : float, optional\n        Widths :math:`B_x, B_y, B_z` of the pulse in m. 0.1 by default.\n    kx, ky, k: float, optional\n        Orders :math:`\\beta` of the pulse. Order 2 by default for axis and 1 for global.\n    Rx: float, optional\n        Radius following x for annular source\n\n    References\n    ----------\n\n    .. [1] S. Kang et al. \302\253\302\240A Physics-Based Approach to Oversample Multi-Satellite,\n        Multi-Species Observations to a Common Grid\302\240\302\273. Preprint. Gases/Remote Sensing/Data\n        Processing and Information Retrieval, 23 ao\303\273t 2018. https://doi.org/10.5194/amt-2018-253.\n    ");
static PyMethodDef __pyx_mdef_6libfds_6cmaths_29super_gaussian2d = {"super_gaussian2d", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_29super_gaussian2d, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6libfds_6cmaths_28super_gaussian2d};
static PyObject *__pyx_pw_6libfds_6cmaths_29super_gaussian2d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  Py_ssize_t __pyx_v_ix0;
  Py_ssize_t __pyx_v_iy0;
  double __pyx_v_S0;
  double __pyx_v_kx;
  double __pyx_v_ky;
  double __pyx_v_k;
  double __pyx_v_Bx;
  double __pyx_v_By;
  double __pyx_v_Rx;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("super_gaussian2d (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_ix0,&__pyx_n_s_iy0,&__pyx_n_s_S0,&__pyx_n_s_kx,&__pyx_n_s_ky,&__pyx_n_s_k,&__pyx_n_s_Bx,&__pyx_n_s_By,&__pyx_n_s_Rx,0};
  PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("super_gaussian2d", 0, 4, 11, 1); __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ix0)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("super_gaussian2d", 0, 4, 11, 2); __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_iy0)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("super_gaussian2d", 0, 4, 11, 3); __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_S0);
          if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kx);
          if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ky);
          if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_k);
          if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_Bx);
          if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_By);
          if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_Rx);
          if (value) { values[10] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "super_gaussian2d") < 0)) __PYX_ERR(0, 691, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_ix0 = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_ix0 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
    __pyx_v_iy0 = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_iy0 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
    if (values[4]) {
      __pyx_v_S0 = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_S0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L3_error)
    } else {
      __pyx_v_S0 = ((double)1.0);
    }
    if (values[5]) {
      __pyx_v_kx = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_kx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 693, __pyx_L3_error)
    } else {
      __pyx_v_kx = ((double)2.0);
    }
    if (values[6]) {
      __pyx_v_ky = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_ky == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 693, __pyx_L3_error)
    } else {
      __pyx_v_ky = ((double)2.0);
    }
    if (values[7]) {
      __pyx_v_k = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_k == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 693, __pyx_L3_error)
    } else {
      __pyx_v_k = ((double)1.0);
    }
    if (values[8]) {
      __pyx_v_Bx = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_Bx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L3_error)
    } else {
      __pyx_v_Bx = ((double)0.1);
    }
    if (values[9]) {
      __pyx_v_By = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_By == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L3_error)
    } else {
      __pyx_v_By = ((double)0.1);
    }
    if (values[10]) {
      __pyx_v_Rx = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_Rx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L3_error)
    } else {
      __pyx_v_Rx = ((double)0.0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("super_gaussian2d", 0, 4, 11, __pyx_nargs); __PYX_ERR(0, 691, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_28super_gaussian2d(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_ix0, __pyx_v_iy0, __pyx_v_S0, __pyx_v_kx, __pyx_v_ky, __pyx_v_k, __pyx_v_Bx, __pyx_v_By, __pyx_v_Rx);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_28super_gaussian2d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, Py_ssize_t __pyx_v_ix0, Py_ssize_t __pyx_v_iy0, double __pyx_v_S0, double __pyx_v_kx, double __pyx_v_ky, double __pyx_v_k, double __pyx_v_Bx, double __pyx_v_By, double __pyx_v_Rx) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__26)
  __Pyx_TraceCall("super_gaussian2d (wrapper)", __pyx_f[0], 691, 0, __PYX_ERR(0, 691, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 7;
  __pyx_t_2.S0 = __pyx_v_S0;
  __pyx_t_2.kx = __pyx_v_kx;
  __pyx_t_2.ky = __pyx_v_ky;
  __pyx_t_2.k = __pyx_v_k;
  __pyx_t_2.Bx = __pyx_v_Bx;
  __pyx_t_2.By = __pyx_v_By;
  __pyx_t_2.Rx = __pyx_v_Rx;
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_super_gaussian2d(__pyx_v_x, __pyx_v_y, __pyx_v_ix0, __pyx_v_iy0, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 691, __pyx_L1_error)
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_1, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(691,0,__PYX_ERR(0, 691, __pyx_L1_error))
/* … */
  __pyx_tuple__54 = PyTuple_Pack(11, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_ix0, __pyx_n_s_iy0, __pyx_n_s_S0, __pyx_n_s_kx, __pyx_n_s_ky, __pyx_n_s_k, __pyx_n_s_Bx, __pyx_n_s_By, __pyx_n_s_Rx); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(11, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_super_gaussian2d, 691, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 691, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_29super_gaussian2d, 0, __pyx_n_s_super_gaussian2d, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__55);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_super_gaussian2d, __pyx_t_7) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_tuple__55 = PyTuple_Pack(7, __pyx_float_1_0, __pyx_float_2_0, __pyx_float_2_0, __pyx_float_1_0, __pyx_float_0_1, __pyx_float_0_1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
 692:                                       double S0=1,
 693:                                       double kx=2, double ky=2, double k=1,
 694:                                       double Bx=0.1, double By=0.1, double Rx=0):
 695:     r"""Super Gaussian distribution.
 696: 
 697:    .. math::
 698: 
 699:         sg = e^{- (\sqrt{(x - x_0)^2 + (y - y_0)^2} + \sqrt{x_r^2 + y_r^2})^{\beta} / (B_x \delta x))^{\beta}}
 700: 
 701:     Parameters
 702:     ----------
 703:     x, y : numpy.ndarray
 704:         Axis of the grid.
 705:     ix0, iy0 : int
 706:         Indices of the initial position of the pulse :math:`(x_0, y_0)`.
 707:     S0 : float, optional
 708:         Amplitude
 709:     Bx, By : float, optional
 710:         Widths :math:`B_x, B_y, B_z` of the pulse in m. 0.1 by default.
 711:     kx, ky, k: float, optional
 712:         Orders :math:`\beta` of the pulse. Order 2 by default for axis and 1 for global.
 713:     Rx: float, optional
 714:         Radius following x for annular source
 715: 
 716:     References
 717:     ----------
 718: 
 719:     .. [1] S. Kang et al. « A Physics-Based Approach to Oversample Multi-Satellite,
 720:         Multi-Species Observations to a Common Grid ». Preprint. Gases/Remote Sensing/Data
 721:         Processing and Information Retrieval, 23 août 2018. https://doi.org/10.5194/amt-2018-253.
 722:     """
+723:     if x.ndim == 2:
  __Pyx_TraceLine(723,0,__PYX_ERR(0, 723, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_1, __pyx_int_2, 2, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
/* … */
  }
+724:         return super_gaussian2dcrv(x, y, ix0, iy0, S0, kx, ky, k, Bx, By, Rx)
    __Pyx_TraceLine(724,0,__PYX_ERR(0, 724, __pyx_L1_error))
    __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_x, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 724, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_y, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 724, __pyx_L1_error)
    __pyx_t_5 = __pyx_f_6libfds_6cmaths_super_gaussian2dcrv(__pyx_t_3, __pyx_t_4, __pyx_v_ix0, __pyx_v_iy0, __pyx_v_S0, __pyx_v_kx, __pyx_v_ky, __pyx_v_k, __pyx_v_Bx, __pyx_v_By, __pyx_v_Rx); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 724, __pyx_L1_error)
    __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
    __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
    __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
    __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
    __pyx_r = __pyx_t_5;
    __pyx_t_5.memview = NULL;
    __pyx_t_5.data = NULL;
    goto __pyx_L0;
 725: 
+726:     return super_gaussian2dcrt(x, y, ix0, iy0, S0, kx, ky, k, Bx, By, Rx)
  __Pyx_TraceLine(726,0,__PYX_ERR(0, 726, __pyx_L1_error))
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_v_x, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 726, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_v_y, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 726, __pyx_L1_error)
  __pyx_t_5 = __pyx_f_6libfds_6cmaths_super_gaussian2dcrt(__pyx_t_6, __pyx_t_7, __pyx_v_ix0, __pyx_v_iy0, __pyx_v_S0, __pyx_v_kx, __pyx_v_ky, __pyx_v_k, __pyx_v_Bx, __pyx_v_By, __pyx_v_Rx); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 726, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __pyx_r = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;
  goto __pyx_L0;
 727: 
 728: 
 729: @cython.cpow(True)
+730: cdef double[:, ::1] super_gaussian2dcrt(double[::1] x, double[::1] y,
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_super_gaussian2dcrt(__Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, Py_ssize_t __pyx_v_ix0, Py_ssize_t __pyx_v_iy0, double __pyx_v_S0, double __pyx_v_kx, double __pyx_v_ky, double __pyx_v_k, double __pyx_v_Bx, double __pyx_v_By, double __pyx_v_Rx) {
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  double __pyx_v_wx;
  double __pyx_v_wy;
  double __pyx_v_R;
  double __pyx_v_xc;
  double __pyx_v_yc;
  __Pyx_memviewslice __pyx_v_m = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("super_gaussian2dcrt", __pyx_f[0], 730, 0, __PYX_ERR(0, 730, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian2dcrt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_m, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(730,0,__PYX_ERR(0, 730, __pyx_L1_error))

 731:                                         Py_ssize_t ix0, Py_ssize_t iy0,
 732:                                         double S0,
 733:                                         double kx, double ky, double k,
 734:                                         double Bx, double By, double Rx):
 735: 
 736:     cdef Py_ssize_t ix, iy
 737: 
+738:     cdef Py_ssize_t nx = x.shape[0]
  __Pyx_TraceLine(738,0,__PYX_ERR(0, 738, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_x.shape[0]);
+739:     cdef Py_ssize_t ny = y.shape[0]
  __Pyx_TraceLine(739,0,__PYX_ERR(0, 739, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_y.shape[0]);
 740: 
+741:     cdef double wx = (np.log(2)**(1 / (kx * k))) / Bx
  __Pyx_TraceLine(741,0,__PYX_ERR(0, 741, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = PyFloat_FromDouble((1.0 / (__pyx_v_kx * __pyx_v_k))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Bx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wx = __pyx_t_5;
+742:     cdef double wy = (np.log(2)**(1 / (ky * k))) / By
  __Pyx_TraceLine(742,0,__PYX_ERR(0, 742, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (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_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyFloat_FromDouble((1.0 / (__pyx_v_ky * __pyx_v_k))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_By); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wy = __pyx_t_5;
+743:     cdef double R = (Rx / wx)**kx
  __Pyx_TraceLine(743,0,__PYX_ERR(0, 743, __pyx_L1_error))
  __pyx_v_R = pow((__pyx_v_Rx / __pyx_v_wx), __pyx_v_kx);
 744: 
+745:     cdef double xc = x[ix0]
  __Pyx_TraceLine(745,0,__PYX_ERR(0, 745, __pyx_L1_error))
  __pyx_t_6 = __pyx_v_ix0;
  __pyx_v_xc = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_6)) )));
+746:     cdef double yc = y[iy0]
  __Pyx_TraceLine(746,0,__PYX_ERR(0, 746, __pyx_L1_error))
  __pyx_t_6 = __pyx_v_iy0;
  __pyx_v_yc = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y.data) + __pyx_t_6)) )));
 747: 
+748:     cdef double[:, ::1] m = np.empty((nx, ny))
  __Pyx_TraceLine(748,0,__PYX_ERR(0, 748, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7)) __PYX_ERR(0, 748, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_m = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
 749: 
+750:     for ix in prange(nx, nogil=True):
  __Pyx_TraceLine(750,0,__PYX_ERR(0, 750, __pyx_L1_error))
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {
        __pyx_t_10 = __pyx_v_nx;
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_10 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_ix) lastprivate(__pyx_v_ix) lastprivate(__pyx_v_iy)
                    #endif /* _OPENMP */
                    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                        {
                            __pyx_v_ix = (Py_ssize_t)(0 + 1 * __pyx_t_11);
                            /* Initialize private variables to invalid values */
                            __pyx_v_iy = ((Py_ssize_t)0xbad0bad0);
/* … */
      __Pyx_TraceLine(750,1,__PYX_ERR(0, 750, __pyx_L4_error))
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }
+751:         for iy in range(ny):
                            __Pyx_TraceLine(751,1,__PYX_ERR(0, 751, __pyx_L8_error))
                            __pyx_t_13 = __pyx_v_ny;
                            __pyx_t_14 = __pyx_t_13;
                            for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
                              __pyx_v_iy = __pyx_t_15;
+752:             m[ix, iy] = S0 * exp(-(fabs((x[ix] - xc) * wx)**kx +
                              __Pyx_TraceLine(752,1,__PYX_ERR(0, 752, __pyx_L8_error))
                              __pyx_t_6 = __pyx_v_ix;
/* … */
                              __Pyx_TraceLine(752,1,__PYX_ERR(0, 752, __pyx_L8_error))
                              __pyx_t_17 = __pyx_v_ix;
                              __pyx_t_18 = __pyx_v_iy;
                              *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_m.data + __pyx_t_17 * __pyx_v_m.strides[0]) )) + __pyx_t_18)) )) = (__pyx_v_S0 * exp((-pow(((pow(fabs((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_6)) ))) - __pyx_v_xc) * __pyx_v_wx)), __pyx_v_kx) + pow(fabs((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y.data) + __pyx_t_16)) ))) - __pyx_v_yc) * __pyx_v_wy)), __pyx_v_ky)) - __pyx_v_R), __pyx_v_k))));
                            }
                            goto __pyx_L13;
                            __pyx_L8_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L12;
                            __pyx_L12:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates2)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_ix;
                                __pyx_parallel_temp1 = __pyx_v_iy;
                            }
                            __pyx_L13:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_ix = __pyx_parallel_temp0;
              __pyx_v_iy = __pyx_parallel_temp1;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L4_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }
+753:                                    fabs((y[iy] - yc) * wy)**ky - R)**k)
                              __Pyx_TraceLine(753,1,__PYX_ERR(0, 753, __pyx_L8_error))
                              __pyx_t_16 = __pyx_v_iy;
 754: 
+755:     return m
  __Pyx_TraceLine(755,0,__PYX_ERR(0, 755, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_m, 1);
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;
 756: 
 757: 
 758: @cython.cpow(True)
+759: cdef double[:, ::1] super_gaussian2dcrv(double[:, ::1] x, double[:, ::1] y,
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_super_gaussian2dcrv(__Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, Py_ssize_t __pyx_v_ix0, Py_ssize_t __pyx_v_iy0, double __pyx_v_S0, double __pyx_v_kx, double __pyx_v_ky, double __pyx_v_k, double __pyx_v_Bx, double __pyx_v_By, double __pyx_v_Rx) {
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  double __pyx_v_wx;
  double __pyx_v_wy;
  double __pyx_v_R;
  double __pyx_v_xc;
  double __pyx_v_yc;
  __Pyx_memviewslice __pyx_v_m = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("super_gaussian2dcrv", __pyx_f[0], 759, 0, __PYX_ERR(0, 759, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian2dcrv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_m, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(759,0,__PYX_ERR(0, 759, __pyx_L1_error))

 760:                                          Py_ssize_t ix0, Py_ssize_t iy0,
 761:                                          double S0,
 762:                                          double kx, double ky, double k,
 763:                                          double Bx, double By, double Rx):
 764: 
 765:     cdef Py_ssize_t ix, iy
 766: 
+767:     cdef Py_ssize_t nx = x.shape[0]
  __Pyx_TraceLine(767,0,__PYX_ERR(0, 767, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_x.shape[0]);
+768:     cdef Py_ssize_t ny = y.shape[1]
  __Pyx_TraceLine(768,0,__PYX_ERR(0, 768, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_y.shape[1]);
 769: 
+770:     cdef double wx = (np.log(2)**(1 / (kx * k))) / Bx
  __Pyx_TraceLine(770,0,__PYX_ERR(0, 770, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = PyFloat_FromDouble((1.0 / (__pyx_v_kx * __pyx_v_k))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Bx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wx = __pyx_t_5;
+771:     cdef double wy = (np.log(2)**(1 / (ky * k))) / By
  __Pyx_TraceLine(771,0,__PYX_ERR(0, 771, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (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_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyFloat_FromDouble((1.0 / (__pyx_v_ky * __pyx_v_k))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_By); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wy = __pyx_t_5;
+772:     cdef double R = (Rx / wx)**kx
  __Pyx_TraceLine(772,0,__PYX_ERR(0, 772, __pyx_L1_error))
  __pyx_v_R = pow((__pyx_v_Rx / __pyx_v_wx), __pyx_v_kx);
 773: 
+774:     cdef double xc = x[ix0, iy0]
  __Pyx_TraceLine(774,0,__PYX_ERR(0, 774, __pyx_L1_error))
  __pyx_t_6 = __pyx_v_ix0;
  __pyx_t_7 = __pyx_v_iy0;
  __pyx_v_xc = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_6 * __pyx_v_x.strides[0]) )) + __pyx_t_7)) )));
+775:     cdef double yc = y[ix0, iy0]
  __Pyx_TraceLine(775,0,__PYX_ERR(0, 775, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_ix0;
  __pyx_t_6 = __pyx_v_iy0;
  __pyx_v_yc = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_7 * __pyx_v_y.strides[0]) )) + __pyx_t_6)) )));
 776: 
+777:     cdef double[:, ::1] m = np.empty((nx, ny))
  __Pyx_TraceLine(777,0,__PYX_ERR(0, 777, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_ny); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2)) __PYX_ERR(0, 777, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_8);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8)) __PYX_ERR(0, 777, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 777, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_m = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
 778: 
+779:     for ix in prange(nx, nogil=True):
  __Pyx_TraceLine(779,0,__PYX_ERR(0, 779, __pyx_L1_error))
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {
        __pyx_t_11 = __pyx_v_nx;
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_13 = (__pyx_t_11 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_13 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_ix) lastprivate(__pyx_v_ix) lastprivate(__pyx_v_iy)
                    #endif /* _OPENMP */
                    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){
                        {
                            __pyx_v_ix = (Py_ssize_t)(0 + 1 * __pyx_t_12);
                            /* Initialize private variables to invalid values */
                            __pyx_v_iy = ((Py_ssize_t)0xbad0bad0);
/* … */
      __Pyx_TraceLine(779,1,__PYX_ERR(0, 779, __pyx_L4_error))
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }
+780:         for iy in range(ny):
                            __Pyx_TraceLine(780,1,__PYX_ERR(0, 780, __pyx_L8_error))
                            __pyx_t_14 = __pyx_v_ny;
                            __pyx_t_15 = __pyx_t_14;
                            for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
                              __pyx_v_iy = __pyx_t_16;
+781:             m[ix, iy] = S0 * exp(-(fabs((x[ix, iy] - xc) * wx)**kx +
                              __Pyx_TraceLine(781,1,__PYX_ERR(0, 781, __pyx_L8_error))
                              __pyx_t_6 = __pyx_v_ix;
                              __pyx_t_7 = __pyx_v_iy;
/* … */
                              __Pyx_TraceLine(781,1,__PYX_ERR(0, 781, __pyx_L8_error))
                              __pyx_t_19 = __pyx_v_ix;
                              __pyx_t_20 = __pyx_v_iy;
                              *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_m.data + __pyx_t_19 * __pyx_v_m.strides[0]) )) + __pyx_t_20)) )) = (__pyx_v_S0 * exp((-pow(((pow(fabs((((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_6 * __pyx_v_x.strides[0]) )) + __pyx_t_7)) ))) - __pyx_v_xc) * __pyx_v_wx)), __pyx_v_kx) + pow(fabs((((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_17 * __pyx_v_y.strides[0]) )) + __pyx_t_18)) ))) - __pyx_v_yc) * __pyx_v_wy)), __pyx_v_ky)) - __pyx_v_R), __pyx_v_k))));
                            }
                            goto __pyx_L13;
                            __pyx_L8_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L12;
                            __pyx_L12:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates3)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_ix;
                                __pyx_parallel_temp1 = __pyx_v_iy;
                            }
                            __pyx_L13:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_ix = __pyx_parallel_temp0;
              __pyx_v_iy = __pyx_parallel_temp1;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L4_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }
+782:                                    fabs((y[ix, iy] - yc) * wy)**ky - R)**k)
                              __Pyx_TraceLine(782,1,__PYX_ERR(0, 782, __pyx_L8_error))
                              __pyx_t_17 = __pyx_v_ix;
                              __pyx_t_18 = __pyx_v_iy;
 783: 
+784:     return m
  __Pyx_TraceLine(784,0,__PYX_ERR(0, 784, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_m, 1);
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;
 785: 
 786: 
+787: cpdef double[:, :, ::1] super_gaussian3d(x, y, z,
static PyObject *__pyx_pw_6libfds_6cmaths_31super_gaussian3d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_super_gaussian3d(PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z, Py_ssize_t __pyx_v_ix0, Py_ssize_t __pyx_v_iy0, Py_ssize_t __pyx_v_iz0, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6libfds_6cmaths_super_gaussian3d *__pyx_optional_args) {
  double __pyx_v_S0 = ((double)1.);
  double __pyx_v_kx = ((double)2.0);
  double __pyx_v_ky = ((double)2.0);
  double __pyx_v_kz = ((double)2.0);
  double __pyx_v_k = ((double)1.0);
  double __pyx_v_Bx = ((double)0.09);
  double __pyx_v_By = ((double)0.09);
  double __pyx_v_Bz = ((double)0.09);
  double __pyx_v_Rx = ((double)0.0);
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__27)
  __Pyx_TraceCall("super_gaussian3d", __pyx_f[0], 787, 0, __PYX_ERR(0, 787, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_S0 = __pyx_optional_args->S0;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_kx = __pyx_optional_args->kx;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_ky = __pyx_optional_args->ky;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_kz = __pyx_optional_args->kz;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_k = __pyx_optional_args->k;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_Bx = __pyx_optional_args->Bx;
                if (__pyx_optional_args->__pyx_n > 6) {
                  __pyx_v_By = __pyx_optional_args->By;
                  if (__pyx_optional_args->__pyx_n > 7) {
                    __pyx_v_Bz = __pyx_optional_args->Bz;
                    if (__pyx_optional_args->__pyx_n > 8) {
                      __pyx_v_Rx = __pyx_optional_args->Rx;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6libfds_6cmaths_31super_gaussian3d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6libfds_6cmaths_30super_gaussian3d, "Super Gaussian distribution.\n\n   .. math::\n\n        sg = e^{- (\\sqrt{(x - x_0)^2 + (y - y_0)^2} + \\sqrt{x_r^2 + y_r^2})^{\010eta} / (B_x \\delta x))^{\010eta}}\n\n\n    Parameters\n    ----------\n    x, y, z : numpy.ndarray\n        Axis of the grid.\n    ix0, iy0, iz0 : int\n        Indices of the initial position of the pulse :math:`(x_0, y_0)`.\n    S0 : float, optional\n        Amplitude\n    Bx, By, Bz : float, optional\n        Widths :math:`B_x, B_y, B_z` of the pulse in m. 0.1 by default.\n    kx, ky, kz, k: float, optional\n        Orders :math:`\010eta` of the pulse. Order 2 by default for axis and 1 for global.\n    Rx: float, optional\n        Radius following x for annular source\n\n    References\n    ----------\n\n    .. [1] S. Kang et al. \302\253\302\240A Physics-Based Approach to Oversample Multi-Satellite,\n        Multi-Species Observations to a Common Grid\302\240\302\273. Preprint. Gases/Remote Sensing/Data\n        Processing and Information Retrieval, 23 ao\303\273t 2018. https://doi.org/10.5194/amt-2018-253.\n    ");
static PyMethodDef __pyx_mdef_6libfds_6cmaths_31super_gaussian3d = {"super_gaussian3d", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6libfds_6cmaths_31super_gaussian3d, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6libfds_6cmaths_30super_gaussian3d};
static PyObject *__pyx_pw_6libfds_6cmaths_31super_gaussian3d(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  Py_ssize_t __pyx_v_ix0;
  Py_ssize_t __pyx_v_iy0;
  Py_ssize_t __pyx_v_iz0;
  double __pyx_v_S0;
  double __pyx_v_kx;
  double __pyx_v_ky;
  double __pyx_v_kz;
  double __pyx_v_k;
  double __pyx_v_Bx;
  double __pyx_v_By;
  double __pyx_v_Bz;
  double __pyx_v_Rx;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("super_gaussian3d (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,&__pyx_n_s_ix0,&__pyx_n_s_iy0,&__pyx_n_s_iz0,&__pyx_n_s_S0,&__pyx_n_s_kx,&__pyx_n_s_ky,&__pyx_n_s_kz,&__pyx_n_s_k,&__pyx_n_s_Bx,&__pyx_n_s_By,&__pyx_n_s_Bz,&__pyx_n_s_Rx,0};
  PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("super_gaussian3d", 0, 6, 15, 1); __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_z)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("super_gaussian3d", 0, 6, 15, 2); __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ix0)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("super_gaussian3d", 0, 6, 15, 3); __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_iy0)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("super_gaussian3d", 0, 6, 15, 4); __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_iz0)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("super_gaussian3d", 0, 6, 15, 5); __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_S0);
          if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kx);
          if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ky);
          if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kz);
          if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_k);
          if (value) { values[10] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_Bx);
          if (value) { values[11] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_By);
          if (value) { values[12] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_Bz);
          if (value) { values[13] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_Rx);
          if (value) { values[14] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 787, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "super_gaussian3d") < 0)) __PYX_ERR(0, 787, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_z = values[2];
    __pyx_v_ix0 = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_ix0 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L3_error)
    __pyx_v_iy0 = __Pyx_PyIndex_AsSsize_t(values[4]); if (unlikely((__pyx_v_iy0 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L3_error)
    __pyx_v_iz0 = __Pyx_PyIndex_AsSsize_t(values[5]); if (unlikely((__pyx_v_iz0 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L3_error)
    if (values[6]) {
      __pyx_v_S0 = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_S0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 789, __pyx_L3_error)
    } else {
      __pyx_v_S0 = ((double)1.);
    }
    if (values[7]) {
      __pyx_v_kx = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_kx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 790, __pyx_L3_error)
    } else {
      __pyx_v_kx = ((double)2.0);
    }
    if (values[8]) {
      __pyx_v_ky = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_ky == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 790, __pyx_L3_error)
    } else {
      __pyx_v_ky = ((double)2.0);
    }
    if (values[9]) {
      __pyx_v_kz = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_kz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 790, __pyx_L3_error)
    } else {
      __pyx_v_kz = ((double)2.0);
    }
    if (values[10]) {
      __pyx_v_k = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_k == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L3_error)
    } else {
      __pyx_v_k = ((double)1.0);
    }
    if (values[11]) {
      __pyx_v_Bx = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_Bx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 792, __pyx_L3_error)
    } else {
      __pyx_v_Bx = ((double)0.09);
    }
    if (values[12]) {
      __pyx_v_By = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_By == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 792, __pyx_L3_error)
    } else {
      __pyx_v_By = ((double)0.09);
    }
    if (values[13]) {
      __pyx_v_Bz = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_Bz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 792, __pyx_L3_error)
    } else {
      __pyx_v_Bz = ((double)0.09);
    }
    if (values[14]) {
      __pyx_v_Rx = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_Rx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 793, __pyx_L3_error)
    } else {
      __pyx_v_Rx = ((double)0.0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("super_gaussian3d", 0, 6, 15, __pyx_nargs); __PYX_ERR(0, 787, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6libfds_6cmaths_30super_gaussian3d(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_ix0, __pyx_v_iy0, __pyx_v_iz0, __pyx_v_S0, __pyx_v_kx, __pyx_v_ky, __pyx_v_kz, __pyx_v_k, __pyx_v_Bx, __pyx_v_By, __pyx_v_Bz, __pyx_v_Rx);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6libfds_6cmaths_30super_gaussian3d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z, Py_ssize_t __pyx_v_ix0, Py_ssize_t __pyx_v_iy0, Py_ssize_t __pyx_v_iz0, double __pyx_v_S0, double __pyx_v_kx, double __pyx_v_ky, double __pyx_v_kz, double __pyx_v_k, double __pyx_v_Bx, double __pyx_v_By, double __pyx_v_Bz, double __pyx_v_Rx) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__27)
  __Pyx_TraceCall("super_gaussian3d (wrapper)", __pyx_f[0], 787, 0, __PYX_ERR(0, 787, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 9;
  __pyx_t_2.S0 = __pyx_v_S0;
  __pyx_t_2.kx = __pyx_v_kx;
  __pyx_t_2.ky = __pyx_v_ky;
  __pyx_t_2.kz = __pyx_v_kz;
  __pyx_t_2.k = __pyx_v_k;
  __pyx_t_2.Bx = __pyx_v_Bx;
  __pyx_t_2.By = __pyx_v_By;
  __pyx_t_2.Bz = __pyx_v_Bz;
  __pyx_t_2.Rx = __pyx_v_Rx;
  __pyx_t_1 = __pyx_f_6libfds_6cmaths_super_gaussian3d(__pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_ix0, __pyx_v_iy0, __pyx_v_iz0, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 787, __pyx_L1_error)
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_1, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian3d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(787,0,__PYX_ERR(0, 787, __pyx_L1_error))
/* … */
  __pyx_tuple__56 = PyTuple_Pack(15, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z, __pyx_n_s_ix0, __pyx_n_s_iy0, __pyx_n_s_iz0, __pyx_n_s_S0, __pyx_n_s_kx, __pyx_n_s_ky, __pyx_n_s_kz, __pyx_n_s_k, __pyx_n_s_Bx, __pyx_n_s_By, __pyx_n_s_Bz, __pyx_n_s_Rx); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);
  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(15, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_libfds_cmaths_pyx, __pyx_n_s_super_gaussian3d, 787, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 787, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libfds_6cmaths_31super_gaussian3d, 0, __pyx_n_s_super_gaussian3d, NULL, __pyx_n_s_libfds_cmaths, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__57);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_super_gaussian3d, __pyx_t_7) < 0) __PYX_ERR(0, 787, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 788:                                          Py_ssize_t ix0, Py_ssize_t iy0, Py_ssize_t iz0,
 789:                                          double S0=1.,
 790:                                          double kx=2, double ky=2, double kz=2,
 791:                                          double k=1,
 792:                                          double Bx=0.09, double By=0.09, double Bz=0.09,
 793:                                          double Rx=0):
 794:     """Super Gaussian distribution.
 795: 
 796:    .. math::
 797: 
 798:         sg = e^{- (\sqrt{(x - x_0)^2 + (y - y_0)^2} + \sqrt{x_r^2 + y_r^2})^{\beta} / (B_x \delta x))^{\beta}}
 799: 
 800: 
 801:     Parameters
 802:     ----------
 803:     x, y, z : numpy.ndarray
 804:         Axis of the grid.
 805:     ix0, iy0, iz0 : int
 806:         Indices of the initial position of the pulse :math:`(x_0, y_0)`.
 807:     S0 : float, optional
 808:         Amplitude
 809:     Bx, By, Bz : float, optional
 810:         Widths :math:`B_x, B_y, B_z` of the pulse in m. 0.1 by default.
 811:     kx, ky, kz, k: float, optional
 812:         Orders :math:`\beta` of the pulse. Order 2 by default for axis and 1 for global.
 813:     Rx: float, optional
 814:         Radius following x for annular source
 815: 
 816:     References
 817:     ----------
 818: 
 819:     .. [1] S. Kang et al. « A Physics-Based Approach to Oversample Multi-Satellite,
 820:         Multi-Species Observations to a Common Grid ». Preprint. Gases/Remote Sensing/Data
 821:         Processing and Information Retrieval, 23 août 2018. https://doi.org/10.5194/amt-2018-253.
 822:     """
+823:     if x.ndim == 3:
  __Pyx_TraceLine(823,0,__PYX_ERR(0, 823, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_1, __pyx_int_3, 3, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
/* … */
  }
+824:         return super_gaussian3dcrv(x, y, z, ix0, iy0, iz0, S0, kx, ky, kz, k, Bx, By, Bz, Rx)
    __Pyx_TraceLine(824,0,__PYX_ERR(0, 824, __pyx_L1_error))
    __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_v_x, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 824, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_v_y, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 824, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_v_z, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 824, __pyx_L1_error)
    __pyx_t_6 = __pyx_f_6libfds_6cmaths_super_gaussian3dcrv(__pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_v_ix0, __pyx_v_iy0, __pyx_v_iz0, __pyx_v_S0, __pyx_v_kx, __pyx_v_ky, __pyx_v_kz, __pyx_v_k, __pyx_v_Bx, __pyx_v_By, __pyx_v_Bz, __pyx_v_Rx); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 824, __pyx_L1_error)
    __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
    __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
    __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
    __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
    __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
    __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
    __pyx_r = __pyx_t_6;
    __pyx_t_6.memview = NULL;
    __pyx_t_6.data = NULL;
    goto __pyx_L0;
 825: 
+826:     return super_gaussian3dcrt(x, y, z, ix0, iy0, iz0, S0, kx, ky, kz, k, Bx, By, Bz, Rx)
  __Pyx_TraceLine(826,0,__PYX_ERR(0, 826, __pyx_L1_error))
  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_v_x, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 826, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_v_y, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 826, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_v_z, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 826, __pyx_L1_error)
  __pyx_t_6 = __pyx_f_6libfds_6cmaths_super_gaussian3dcrt(__pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_v_ix0, __pyx_v_iy0, __pyx_v_iz0, __pyx_v_S0, __pyx_v_kx, __pyx_v_ky, __pyx_v_kz, __pyx_v_k, __pyx_v_Bx, __pyx_v_By, __pyx_v_Bz, __pyx_v_Rx); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 826, __pyx_L1_error)
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1);
  __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
  __pyx_r = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;
  goto __pyx_L0;
 827: 
 828: 
 829: @cython.cpow(True)
+830: cdef double[:, :, ::1] super_gaussian3dcrt(double[::1] x, double[::1] y, double[::1] z,
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_super_gaussian3dcrt(__Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_z, Py_ssize_t __pyx_v_ix0, Py_ssize_t __pyx_v_iy0, Py_ssize_t __pyx_v_iz0, double __pyx_v_S0, double __pyx_v_kx, double __pyx_v_ky, double __pyx_v_kz, double __pyx_v_k, double __pyx_v_Bx, double __pyx_v_By, double __pyx_v_Bz, double __pyx_v_Rx) {
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  double __pyx_v_wx;
  double __pyx_v_wy;
  double __pyx_v_wz;
  double __pyx_v_R;
  double __pyx_v_xc;
  double __pyx_v_yc;
  double __pyx_v_zc;
  __Pyx_memviewslice __pyx_v_m = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("super_gaussian3dcrt", __pyx_f[0], 830, 0, __PYX_ERR(0, 830, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian3dcrt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_m, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(830,0,__PYX_ERR(0, 830, __pyx_L1_error))

 831:                                            Py_ssize_t ix0, Py_ssize_t iy0, Py_ssize_t iz0,
 832:                                            double S0,
 833:                                            double kx, double ky, double kz, double k,
 834:                                            double Bx, double By, double Bz, double Rx):
 835: 
 836:     cdef Py_ssize_t ix, iy, iz
 837: 
+838:     cdef Py_ssize_t nx = x.shape[0]
  __Pyx_TraceLine(838,0,__PYX_ERR(0, 838, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_x.shape[0]);
+839:     cdef Py_ssize_t ny = y.shape[0]
  __Pyx_TraceLine(839,0,__PYX_ERR(0, 839, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_y.shape[0]);
+840:     cdef Py_ssize_t nz = z.shape[0]
  __Pyx_TraceLine(840,0,__PYX_ERR(0, 840, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_z.shape[0]);
 841: 
+842:     cdef double wx = (np.log(2)**(1 / (kx * k))) / Bx
  __Pyx_TraceLine(842,0,__PYX_ERR(0, 842, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = PyFloat_FromDouble((1.0 / (__pyx_v_kx * __pyx_v_k))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Bx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wx = __pyx_t_5;
+843:     cdef double wy = (np.log(2)**(1 / (ky * k))) / By
  __Pyx_TraceLine(843,0,__PYX_ERR(0, 843, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (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_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyFloat_FromDouble((1.0 / (__pyx_v_ky * __pyx_v_k))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_By); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wy = __pyx_t_5;
+844:     cdef double wz = (np.log(2)**(1 / (kz * k))) / Bz
  __Pyx_TraceLine(844,0,__PYX_ERR(0, 844, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = PyFloat_FromDouble((1.0 / (__pyx_v_kz * __pyx_v_k))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Bz); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wz = __pyx_t_5;
+845:     cdef double R = (Rx * wx)**kx
  __Pyx_TraceLine(845,0,__PYX_ERR(0, 845, __pyx_L1_error))
  __pyx_v_R = pow((__pyx_v_Rx * __pyx_v_wx), __pyx_v_kx);
 846: 
+847:     cdef double xc = x[ix0]
  __Pyx_TraceLine(847,0,__PYX_ERR(0, 847, __pyx_L1_error))
  __pyx_t_6 = __pyx_v_ix0;
  __pyx_v_xc = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_6)) )));
+848:     cdef double yc = y[iy0]
  __Pyx_TraceLine(848,0,__PYX_ERR(0, 848, __pyx_L1_error))
  __pyx_t_6 = __pyx_v_iy0;
  __pyx_v_yc = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y.data) + __pyx_t_6)) )));
+849:     cdef double zc = z[iz0]
  __Pyx_TraceLine(849,0,__PYX_ERR(0, 849, __pyx_L1_error))
  __pyx_t_6 = __pyx_v_iz0;
  __pyx_v_zc = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_z.data) + __pyx_t_6)) )));
 850: 
+851:     cdef double[:, :, ::1] m = np.empty((nx, ny, nz))
  __Pyx_TraceLine(851,0,__PYX_ERR(0, 851, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_nz); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7)) __PYX_ERR(0, 851, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_8);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8)) __PYX_ERR(0, 851, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_m = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
 852: 
+853:     for ix in prange(nx, nogil=True):
  __Pyx_TraceLine(853,0,__PYX_ERR(0, 853, __pyx_L1_error))
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {
        __pyx_t_11 = __pyx_v_nx;
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_13 = (__pyx_t_11 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_13 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_ix) lastprivate(__pyx_v_ix) lastprivate(__pyx_v_iy) lastprivate(__pyx_v_iz)
                    #endif /* _OPENMP */
                    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){
                        {
                            __pyx_v_ix = (Py_ssize_t)(0 + 1 * __pyx_t_12);
                            /* Initialize private variables to invalid values */
                            __pyx_v_iy = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_iz = ((Py_ssize_t)0xbad0bad0);
/* … */
      __Pyx_TraceLine(853,1,__PYX_ERR(0, 853, __pyx_L4_error))
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }
+854:         for iy in range(ny):
                            __Pyx_TraceLine(854,1,__PYX_ERR(0, 854, __pyx_L8_error))
                            __pyx_t_14 = __pyx_v_ny;
                            __pyx_t_15 = __pyx_t_14;
                            for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
                              __pyx_v_iy = __pyx_t_16;
+855:             for iz in range(nz):
                              __Pyx_TraceLine(855,1,__PYX_ERR(0, 855, __pyx_L8_error))
                              __pyx_t_17 = __pyx_v_nz;
                              __pyx_t_18 = __pyx_t_17;
                              for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
                                __pyx_v_iz = __pyx_t_19;
+856:                 m[ix, iy, iz] = S0 * exp(-(fabs((x[ix] - xc) * wx)**kx +
                                __Pyx_TraceLine(856,1,__PYX_ERR(0, 856, __pyx_L8_error))
                                __pyx_t_6 = __pyx_v_ix;
/* … */
                                __Pyx_TraceLine(856,1,__PYX_ERR(0, 856, __pyx_L8_error))
                                __pyx_t_22 = __pyx_v_ix;
                                __pyx_t_23 = __pyx_v_iy;
                                __pyx_t_24 = __pyx_v_iz;
                                *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_m.data + __pyx_t_22 * __pyx_v_m.strides[0]) ) + __pyx_t_23 * __pyx_v_m.strides[1]) )) + __pyx_t_24)) )) = (__pyx_v_S0 * exp((-pow((((pow(fabs((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_6)) ))) - __pyx_v_xc) * __pyx_v_wx)), __pyx_v_kx) + pow(fabs((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y.data) + __pyx_t_20)) ))) - __pyx_v_yc) * __pyx_v_wy)), __pyx_v_ky)) + pow(fabs((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_z.data) + __pyx_t_21)) ))) - __pyx_v_zc) * __pyx_v_wz)), __pyx_v_kz)) - __pyx_v_R), __pyx_v_k))));
                              }
                            }
                            goto __pyx_L15;
                            __pyx_L8_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L14;
                            __pyx_L14:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates4)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_ix;
                                __pyx_parallel_temp1 = __pyx_v_iy;
                                __pyx_parallel_temp2 = __pyx_v_iz;
                            }
                            __pyx_L15:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_ix = __pyx_parallel_temp0;
              __pyx_v_iy = __pyx_parallel_temp1;
              __pyx_v_iz = __pyx_parallel_temp2;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L4_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }
+857:                                            fabs((y[iy] - yc) * wy)**ky +
                                __Pyx_TraceLine(857,1,__PYX_ERR(0, 857, __pyx_L8_error))
                                __pyx_t_20 = __pyx_v_iy;
+858:                                            fabs((z[iz] - zc) * wz)**kz - R)**k)
                                __Pyx_TraceLine(858,1,__PYX_ERR(0, 858, __pyx_L8_error))
                                __pyx_t_21 = __pyx_v_iz;
+859:     return m
  __Pyx_TraceLine(859,0,__PYX_ERR(0, 859, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_m, 1);
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;
 860: 
 861: 
 862: @cython.cpow(True)
+863: cdef double[:, :, ::1] super_gaussian3dcrv(double[:, :, ::1] x, double[:, :, ::1] y, double[:, :, ::1] z,
static __Pyx_memviewslice __pyx_f_6libfds_6cmaths_super_gaussian3dcrv(__Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_z, Py_ssize_t __pyx_v_ix0, Py_ssize_t __pyx_v_iy0, Py_ssize_t __pyx_v_iz0, double __pyx_v_S0, double __pyx_v_kx, double __pyx_v_ky, double __pyx_v_kz, double __pyx_v_k, double __pyx_v_Bx, double __pyx_v_By, double __pyx_v_Bz, double __pyx_v_Rx) {
  Py_ssize_t __pyx_v_ix;
  Py_ssize_t __pyx_v_iy;
  Py_ssize_t __pyx_v_iz;
  Py_ssize_t __pyx_v_nx;
  Py_ssize_t __pyx_v_ny;
  Py_ssize_t __pyx_v_nz;
  double __pyx_v_wx;
  double __pyx_v_wy;
  double __pyx_v_wz;
  double __pyx_v_R;
  double __pyx_v_xc;
  double __pyx_v_yc;
  double __pyx_v_zc;
  __Pyx_memviewslice __pyx_v_m = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("super_gaussian3dcrv", __pyx_f[0], 863, 0, __PYX_ERR(0, 863, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __PYX_XCLEAR_MEMVIEW(&__pyx_t_12, 1);
  __pyx_r.data = NULL;
  __pyx_r.memview = NULL;
  __Pyx_AddTraceback("libfds.cmaths.super_gaussian3dcrv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  goto __pyx_L2;
  __pyx_L0:;
  if (unlikely(!__pyx_r.memview)) {
    PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
  }
  __pyx_L2:;
  __PYX_XCLEAR_MEMVIEW(&__pyx_v_m, 1);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_TraceLine(863,0,__PYX_ERR(0, 863, __pyx_L1_error))

 864:                                            Py_ssize_t ix0, Py_ssize_t iy0, Py_ssize_t iz0,
 865:                                            double S0,
 866:                                            double kx, double ky, double kz, double k,
 867:                                            double Bx, double By, double Bz, double Rx):
 868: 
 869:     cdef Py_ssize_t ix, iy, iz
 870: 
+871:     cdef Py_ssize_t nx = x.shape[0]
  __Pyx_TraceLine(871,0,__PYX_ERR(0, 871, __pyx_L1_error))
  __pyx_v_nx = (__pyx_v_x.shape[0]);
+872:     cdef Py_ssize_t ny = y.shape[1]
  __Pyx_TraceLine(872,0,__PYX_ERR(0, 872, __pyx_L1_error))
  __pyx_v_ny = (__pyx_v_y.shape[1]);
+873:     cdef Py_ssize_t nz = z.shape[2]
  __Pyx_TraceLine(873,0,__PYX_ERR(0, 873, __pyx_L1_error))
  __pyx_v_nz = (__pyx_v_z.shape[2]);
 874: 
+875:     cdef double wx = (np.log(2)**(1 / (kx * k))) / Bx
  __Pyx_TraceLine(875,0,__PYX_ERR(0, 875, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = PyFloat_FromDouble((1.0 / (__pyx_v_kx * __pyx_v_k))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Bx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 875, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wx = __pyx_t_5;
+876:     cdef double wy = (np.log(2)**(1 / (ky * k))) / By
  __Pyx_TraceLine(876,0,__PYX_ERR(0, 876, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (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_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyFloat_FromDouble((1.0 / (__pyx_v_ky * __pyx_v_k))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_By); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wy = __pyx_t_5;
+877:     cdef double wz = (np.log(2)**(1 / (kz * k))) / Bz
  __Pyx_TraceLine(877,0,__PYX_ERR(0, 877, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = PyFloat_FromDouble((1.0 / (__pyx_v_kz * __pyx_v_k))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Bz); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_wz = __pyx_t_5;
+878:     cdef double R = (Rx * wx)**kx
  __Pyx_TraceLine(878,0,__PYX_ERR(0, 878, __pyx_L1_error))
  __pyx_v_R = pow((__pyx_v_Rx * __pyx_v_wx), __pyx_v_kx);
 879: 
+880:     cdef double xc = x[ix0, iy0, iz0]
  __Pyx_TraceLine(880,0,__PYX_ERR(0, 880, __pyx_L1_error))
  __pyx_t_6 = __pyx_v_ix0;
  __pyx_t_7 = __pyx_v_iy0;
  __pyx_t_8 = __pyx_v_iz0;
  __pyx_v_xc = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_x.data + __pyx_t_6 * __pyx_v_x.strides[0]) ) + __pyx_t_7 * __pyx_v_x.strides[1]) )) + __pyx_t_8)) )));
+881:     cdef double yc = y[ix0, iy0, iz0]
  __Pyx_TraceLine(881,0,__PYX_ERR(0, 881, __pyx_L1_error))
  __pyx_t_8 = __pyx_v_ix0;
  __pyx_t_7 = __pyx_v_iy0;
  __pyx_t_6 = __pyx_v_iz0;
  __pyx_v_yc = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_y.data + __pyx_t_8 * __pyx_v_y.strides[0]) ) + __pyx_t_7 * __pyx_v_y.strides[1]) )) + __pyx_t_6)) )));
+882:     cdef double zc = z[ix0, iy0, iz0]
  __Pyx_TraceLine(882,0,__PYX_ERR(0, 882, __pyx_L1_error))
  __pyx_t_6 = __pyx_v_ix0;
  __pyx_t_7 = __pyx_v_iy0;
  __pyx_t_8 = __pyx_v_iz0;
  __pyx_v_zc = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_z.data + __pyx_t_6 * __pyx_v_z.strides[0]) ) + __pyx_t_7 * __pyx_v_z.strides[1]) )) + __pyx_t_8)) )));
 883: 
+884:     cdef double[:, :, ::1] m = np.empty((nx, ny, nz))
  __Pyx_TraceLine(884,0,__PYX_ERR(0, 884, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_ny); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_nz); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3)) __PYX_ERR(0, 884, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9)) __PYX_ERR(0, 884, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_10);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10)) __PYX_ERR(0, 884, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_11};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_m = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;
 885: 
+886:     for ix in prange(nx, nogil=True):
  __Pyx_TraceLine(886,0,__PYX_ERR(0, 886, __pyx_L1_error))
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {
        __pyx_t_13 = __pyx_v_nx;
        {
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_15 = (__pyx_t_13 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_15 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_ix) lastprivate(__pyx_v_ix) lastprivate(__pyx_v_iy) lastprivate(__pyx_v_iz)
                    #endif /* _OPENMP */
                    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){
                        {
                            __pyx_v_ix = (Py_ssize_t)(0 + 1 * __pyx_t_14);
                            /* Initialize private variables to invalid values */
                            __pyx_v_iy = ((Py_ssize_t)0xbad0bad0);
                            __pyx_v_iz = ((Py_ssize_t)0xbad0bad0);
/* … */
      __Pyx_TraceLine(886,1,__PYX_ERR(0, 886, __pyx_L4_error))
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }
+887:         for iy in range(ny):
                            __Pyx_TraceLine(887,1,__PYX_ERR(0, 887, __pyx_L8_error))
                            __pyx_t_16 = __pyx_v_ny;
                            __pyx_t_17 = __pyx_t_16;
                            for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                              __pyx_v_iy = __pyx_t_18;
+888:             for iz in range(nz):
                              __Pyx_TraceLine(888,1,__PYX_ERR(0, 888, __pyx_L8_error))
                              __pyx_t_19 = __pyx_v_nz;
                              __pyx_t_20 = __pyx_t_19;
                              for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
                                __pyx_v_iz = __pyx_t_21;
+889:                 m[ix, iy, iz] = S0 * exp(-(fabs((x[ix, iy, iz] - xc) * wx)**kx +
                                __Pyx_TraceLine(889,1,__PYX_ERR(0, 889, __pyx_L8_error))
                                __pyx_t_8 = __pyx_v_ix;
                                __pyx_t_7 = __pyx_v_iy;
                                __pyx_t_6 = __pyx_v_iz;
/* … */
                                __Pyx_TraceLine(889,1,__PYX_ERR(0, 889, __pyx_L8_error))
                                __pyx_t_28 = __pyx_v_ix;
                                __pyx_t_29 = __pyx_v_iy;
                                __pyx_t_30 = __pyx_v_iz;
                                *((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_m.data + __pyx_t_28 * __pyx_v_m.strides[0]) ) + __pyx_t_29 * __pyx_v_m.strides[1]) )) + __pyx_t_30)) )) = (__pyx_v_S0 * exp((-pow((((pow(fabs((((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_x.data + __pyx_t_8 * __pyx_v_x.strides[0]) ) + __pyx_t_7 * __pyx_v_x.strides[1]) )) + __pyx_t_6)) ))) - __pyx_v_xc) * __pyx_v_wx)), __pyx_v_kx) + pow(fabs((((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_y.data + __pyx_t_22 * __pyx_v_y.strides[0]) ) + __pyx_t_23 * __pyx_v_y.strides[1]) )) + __pyx_t_24)) ))) - __pyx_v_yc) * __pyx_v_wy)), __pyx_v_ky)) + pow(fabs((((*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_z.data + __pyx_t_25 * __pyx_v_z.strides[0]) ) + __pyx_t_26 * __pyx_v_z.strides[1]) )) + __pyx_t_27)) ))) - __pyx_v_zc) * __pyx_v_wz)), __pyx_v_kz)) - __pyx_v_R), __pyx_v_k))));
                              }
                            }
                            goto __pyx_L15;
                            __pyx_L8_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L14;
                            __pyx_L14:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates5)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_ix;
                                __pyx_parallel_temp1 = __pyx_v_iy;
                                __pyx_parallel_temp2 = __pyx_v_iz;
                            }
                            __pyx_L15:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_ix = __pyx_parallel_temp0;
              __pyx_v_iy = __pyx_parallel_temp1;
              __pyx_v_iz = __pyx_parallel_temp2;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L4_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }
+890:                                            fabs((y[ix, iy, iz] - yc) * wy)**ky +
                                __Pyx_TraceLine(890,1,__PYX_ERR(0, 890, __pyx_L8_error))
                                __pyx_t_22 = __pyx_v_ix;
                                __pyx_t_23 = __pyx_v_iy;
                                __pyx_t_24 = __pyx_v_iz;
+891:                                            fabs((z[ix, iy, iz] - zc) * wz)**kz - R)**k)
                                __Pyx_TraceLine(891,1,__PYX_ERR(0, 891, __pyx_L8_error))
                                __pyx_t_25 = __pyx_v_ix;
                                __pyx_t_26 = __pyx_v_iy;
                                __pyx_t_27 = __pyx_v_iz;
 892: 
+893:     return m
  __Pyx_TraceLine(893,0,__PYX_ERR(0, 893, __pyx_L1_error))
  __PYX_INC_MEMVIEW(&__pyx_v_m, 1);
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;