/* Generated by Cython 0.29.21 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/Users/karlfredrikstromberg/Devel/sage94/local/lib/python3.8/site-packages/cypari2/cypari.h",
            "/Users/karlfredrikstromberg/Devel/sage94/local/lib/python3.8/site-packages/sage/cpython/cython_metaclass.h",
            "/Users/karlfredrikstromberg/Devel/sage94/local/lib/python3.8/site-packages/sage/libs/ntl/ntlwrap.h"
        ],
        "extra_compile_args": [
            "-std=c++11"
        ],
        "include_dirs": [
            "/Users/karlfredrikstromberg/Devel/sage94/local/lib/python3.8/site-packages/sage/cpython",
            "/Users/karlfredrikstromberg/Devel/sage94/local/lib/python3.8/site-packages/cypari2",
            "/Users/karlfredrikstromberg/Devel/sage94/local/lib/python3.8/site-packages/sage/libs/ntl"
        ],
        "language": "c++",
        "libraries": [
            "gmp"
        ],
        "name": "hilbert_modgroup.pullback_cython",
        "sources": [
            "src/hilbert_modgroup/pullback_cython.pyx"
        ]
    },
    "module_name": "hilbert_modgroup.pullback_cython"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_21"
#define CYTHON_HEX_VERSION 0x001D15F0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsHash_t
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__hilbert_modgroup__pullback_cython
#define __PYX_HAVE_API__hilbert_modgroup__pullback_cython
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "gmp.h"
#include "mpfr.h"
#include "mpc.h"
#include "cython_metaclass.h"
#include "pari/pari.h"
#include "cypari.h"
#include <stdint.h>
#include "ntlwrap.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "src/hilbert_modgroup/pullback_cython.pyx",
  "parent.pxd",
  "element.pxd",
  "real_mpfr.pxd",
  "integer.pxd",
  "sage_object.pxd",
  "category_object.pxd",
  "type.pxd",
  "coerce_dict.pxd",
  "inherit_comparison.pxd",
  "parent_old.pxd",
  "parent_base.pxd",
  "parent_gens.pxd",
  "ring.pxd",
  "complex_mpc.pxd",
  "src/hilbert_modgroup/upper_half_plane.pxd",
  "map.pxd",
  "morphism.pxd",
  "binary_tree.pxd",
  "polynomial_compiled.pxd",
  "polynomial_element.pxd",
  "ntl_ZZX.pxd",
  "ntl_ZZ.pxd",
  "number_field_element.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_4sage_9structure_11sage_object_SageObject;
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject;
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict;
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict;
struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass;
struct __pyx_obj_4sage_9structure_6parent_Parent;
struct __pyx_obj_4sage_9structure_10parent_old_Parent;
struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase;
struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens;
struct __pyx_obj_4sage_5rings_4ring_Ring;
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing;
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain;
struct __pyx_obj_4sage_5rings_4ring_DedekindDomain;
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain;
struct __pyx_obj_4sage_5rings_4ring_EuclideanDomain;
struct __pyx_obj_4sage_5rings_4ring_Field;
struct __pyx_obj_4sage_5rings_4ring_Algebra;
struct __pyx_obj_4sage_5rings_4ring_CommutativeAlgebra;
struct __pyx_obj_4sage_9structure_6parent_Set_generic;
struct __pyx_obj_4sage_9structure_7element_Element;
struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod;
struct __pyx_obj_4sage_9structure_7element_ModuleElement;
struct __pyx_obj_4sage_9structure_7element_ModuleElementWithMutability;
struct __pyx_obj_4sage_9structure_7element_MonoidElement;
struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement;
struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement;
struct __pyx_obj_4sage_9structure_7element_RingElement;
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement;
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement;
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement;
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement;
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement;
struct __pyx_obj_4sage_9structure_7element_FieldElement;
struct __pyx_obj_4sage_9structure_7element_AlgebraElement;
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement;
struct __pyx_obj_4sage_9structure_7element_InfinityElement;
struct __pyx_obj_4sage_9structure_7element_Vector;
struct __pyx_obj_4sage_9structure_7element_Matrix;
struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber;
struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexField_class;
struct __pyx_obj_4sage_5rings_9real_mpfr_RealField_class;
struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber;
struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class;
struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class;
struct __pyx_obj_4sage_10categories_3map_Map;
struct __pyx_obj_4sage_10categories_3map_Section;
struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap;
struct __pyx_obj_4sage_10categories_8morphism_Morphism;
struct __pyx_obj_4sage_10categories_8morphism_SetMorphism;
struct __pyx_obj_4sage_5rings_7integer_Integer;
struct __pyx_obj_4sage_5rings_7integer_int_to_Z;
struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_var_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_add_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd;
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd;
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial;
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense;
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact;
struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX;
struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ;
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement;
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute;
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative;
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute;
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_relative;
struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell;
struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell;

/* "sage/structure/coerce_dict.pxd":5
 * 
 * 
 * cdef struct mono_cell:             # <<<<<<<<<<<<<<
 *     PyObject* key_id
 *     PyObject* key_weakref
 */
struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell {
  PyObject *key_id;
  PyObject *key_weakref;
  PyObject *value;
};

/* "sage/structure/coerce_dict.pxd":27
 * 
 * 
 * cdef struct triple_cell:             # <<<<<<<<<<<<<<
 *     PyObject* key_id1
 *     PyObject* key_id2
 */
struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell {
  PyObject *key_id1;
  PyObject *key_id2;
  PyObject *key_id3;
  PyObject *key_weakref1;
  PyObject *key_weakref2;
  PyObject *key_weakref3;
  PyObject *value;
};
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce;
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action;
struct __pyx_opt_args_4sage_9structure_6parent_6Parent__generic_convert_map;
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action;

/* "parent.pxd":108
 * 
 * # Flags for Parent.flags
 * cdef enum:             # <<<<<<<<<<<<<<
 *     # If this flag is set, call __richcmp__ on elements without
 *     # coercion. This allows a completely custom comparison function.
 */
enum  {
  __pyx_e_4sage_9structure_6parent_Parent_richcmp_element_without_coercion = 1
};

/* "parent.pxd":34
 * 
 *     # Called from the __init__ method to set up coercion.
 *     cdef int init_coerce(self, bint warn=*) except -1             # <<<<<<<<<<<<<<
 * 
 *     # returns whether or not there is a Morphism from S to self
 */
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce {
  int __pyx_n;
  int warn;
};

/* "parent.pxd":52
 *     # returns the Action by/on self on/by S
 *     # corresponding to op and self_on_left
 *     cpdef get_action(self, S, op=*, bint self_on_left=*, self_el=*, S_el=*)             # <<<<<<<<<<<<<<
 *     cpdef _get_action_(self, S, op, bint self_on_left)
 * 
 */
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action {
  int __pyx_n;
  PyObject *op;
  int self_on_left;
  PyObject *self_el;
  PyObject *S_el;
};

/* "parent.pxd":62
 * 
 *     # For internal use
 *     cpdef _generic_convert_map(self, S, category=*)             # <<<<<<<<<<<<<<
 *     cpdef _generic_coerce_map(self, S)
 *     cdef discover_coerce_map_from(self, S)
 */
struct __pyx_opt_args_4sage_9structure_6parent_6Parent__generic_convert_map {
  int __pyx_n;
  PyObject *category;
};

/* "parent.pxd":66
 *     cdef discover_coerce_map_from(self, S)
 *     cdef discover_convert_map_from(self, S)
 *     cdef discover_action(self, S, op, bint self_on_left, self_el=*, S_el=*)             # <<<<<<<<<<<<<<
 * 
 *     # List consisting of Morphisms (from anything to self)
 */
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action {
  int __pyx_n;
  PyObject *self_el;
  PyObject *S_el;
};
struct __pyx_opt_args_4sage_5rings_9real_mpfr_RealField;

/* "sage/rings/real_mpfr.pxd":31
 *     cdef RealNumber abs(RealNumber self)
 * 
 * cpdef RealField(mpfr_prec_t prec=*, int sci_not=*, rnd=*)             # <<<<<<<<<<<<<<
 */
struct __pyx_opt_args_4sage_5rings_9real_mpfr_RealField {
  int __pyx_n;
  mpfr_prec_t prec;
  int sci_not;
  PyObject *rnd;
};
struct __pyx_opt_args_16hilbert_modgroup_16upper_half_plane_33ComplexPlaneProductElement__class_vector_norm;

/* "hilbert_modgroup/upper_half_plane.pxd":46
 *     cpdef norm(self)
 *     cpdef vector(self)
 *     cpdef vector_norm(self, p=?)             # <<<<<<<<<<<<<<
 *     cpdef apply(self, m)
 * 
 */
struct __pyx_opt_args_16hilbert_modgroup_16upper_half_plane_33ComplexPlaneProductElement__class_vector_norm {
  int __pyx_n;
  PyObject *p;
};
struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args;

/* "map.pxd":15
 *     # these methods require x is an element of domain, and returns an element with parent codomain
 *     cpdef Element _call_(self, x)
 *     cpdef Element _call_with_args(self, x, args=*, kwds=*)             # <<<<<<<<<<<<<<
 * 
 *     cdef public domain    # will be either a weakref or a constant map
 */
struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args {
  int __pyx_n;
  PyObject *args;
  PyObject *kwds;
};
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node;

/* "sage/misc/binary_tree.pxd":1
 * cdef struct binary_tree_node:             # <<<<<<<<<<<<<<
 *     int key
 *     binary_tree_node *left
 */
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node {
  int key;
  struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *left;
  struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *right;
  void *value;
};
struct __pyx_opt_args_4sage_5rings_10polynomial_18polynomial_element_10Polynomial_list;
struct __pyx_opt_args_4sage_5rings_10polynomial_18polynomial_element_10Polynomial__mpoly_dict_recursive;
struct __pyx_opt_args_4sage_5rings_10polynomial_18polynomial_element_24Polynomial_generic_dense_list;

/* "sage/rings/polynomial/polynomial_element.pxd":17
 *     cpdef constant_coefficient(self)
 *     cpdef Polynomial _new_constant_poly(self, a, Parent P)
 *     cpdef list list(self, bint copy=*)             # <<<<<<<<<<<<<<
 *     cpdef _mul_generic(self, right)
 *     cdef _square_generic(self)
 */
struct __pyx_opt_args_4sage_5rings_10polynomial_18polynomial_element_10Polynomial_list {
  int __pyx_n;
  int copy;
};

/* "sage/rings/polynomial/polynomial_element.pxd":25
 *     cpdef bint is_term(self) except -1
 * 
 *     cpdef dict _mpoly_dict_recursive(self, tuple variables=*, base_ring=*)             # <<<<<<<<<<<<<<
 * 
 *     cpdef _add_(self, other)
 */
struct __pyx_opt_args_4sage_5rings_10polynomial_18polynomial_element_10Polynomial__mpoly_dict_recursive {
  int __pyx_n;
  PyObject *variables;
  PyObject *base_ring;
};

/* "sage/rings/polynomial/polynomial_element.pxd":53
 *     cdef list __coeffs
 *     cdef int __normalize(self) except -1
 *     cpdef list list(self, bint copy=*)             # <<<<<<<<<<<<<<
 * 
 * cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense):
 */
struct __pyx_opt_args_4sage_5rings_10polynomial_18polynomial_element_24Polynomial_generic_dense_list {
  int __pyx_n;
  int copy;
};
struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box;
struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_candidate_cusps;
struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_closest_cusp;

/* "hilbert_modgroup/pullback_cython.pyx":68
 *     return list(cartesian_product(coordinates))
 * 
 * cpdef lattice_elements_in_box(lattice_basis, lattice_bounds, coordinate_bounds, norm_bound=None):             # <<<<<<<<<<<<<<
 *     """
 *     Return all coordinates of elements in a lattice in R^n restricted to a specific box and with
 */
struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box {
  int __pyx_n;
  PyObject *norm_bound;
};

/* "hilbert_modgroup/pullback_cython.pyx":156
 * 
 * 
 * cpdef find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False,             # <<<<<<<<<<<<<<
 *                            initial_bd_d=None,
 *                            use_initial_bd_d=True):
 */
struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_candidate_cusps {
  int __pyx_n;
  PyObject *use_lll;
  PyObject *use_norm_bound;
  PyObject *return_sigma_candidates;
  PyObject *initial_bd_d;
  PyObject *use_initial_bd_d;
};

/* "hilbert_modgroup/pullback_cython.pyx":276
 *     return result
 * 
 * cpdef find_closest_cusp(p, z, return_multiple=False, use_lll=True, use_norm_bound=True):             # <<<<<<<<<<<<<<
 *     r"""
 *     Return the closest cusp(s) to z
 */
struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_closest_cusp {
  int __pyx_n;
  PyObject *return_multiple;
  PyObject *use_lll;
  PyObject *use_norm_bound;
};

/* "sage/structure/sage_object.pxd":1
 * cdef class SageObject:             # <<<<<<<<<<<<<<
 *     pass
 */
struct __pyx_obj_4sage_9structure_11sage_object_SageObject {
  PyObject_HEAD
};


/* "sage/structure/category_object.pxd":15
 * cpdef check_default_category(default_category, category)
 * 
 * cdef class CategoryObject(SageObject):             # <<<<<<<<<<<<<<
 *     cdef public dict __cached_methods
 *     cdef _category
 */
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject {
  struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
  struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject *__pyx_vtab;
  PyObject *__cached_methods;
  PyObject *_category;
  PyObject *_base;
  PyObject *_names;
  PyObject *_factory_data;
  PyObject *__weakref__;
  long _hash_value;
};


/* "sage/structure/coerce_dict.pxd":12
 * 
 * @cython.final
 * cdef class MonoDict:             # <<<<<<<<<<<<<<
 *     cdef __weakref__
 *     cdef size_t mask  # size - 1 with 'size' the length of the table array
 */
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict {
  PyObject_HEAD
  struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict *__pyx_vtab;
  PyObject *__weakref__;
  size_t mask;
  size_t used;
  size_t fill;
  struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell *table;
  int weak_values;
  PyObject *eraser;
};


/* "sage/structure/coerce_dict.pxd":38
 * 
 * @cython.final
 * cdef class TripleDict:             # <<<<<<<<<<<<<<
 *     cdef __weakref__
 *     cdef size_t mask  # size - 1 with 'size' the length of the table array
 */
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict {
  PyObject_HEAD
  struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict *__pyx_vtab;
  PyObject *__weakref__;
  size_t mask;
  size_t used;
  size_t fill;
  struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell *table;
  int weak_values;
  PyObject *eraser;
};


/* "sage/misc/inherit_comparison.pxd":3
 * cimport sage.cpython.cython_metaclass
 * 
 * cdef class InheritComparisonMetaclass(type):             # <<<<<<<<<<<<<<
 *     pass
 */
struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass {
  PyHeapTypeObject __pyx_base;
};


/* "parent.pxd":12
 * from sage.structure.coerce_dict cimport MonoDict, TripleDict
 * 
 * cdef class Parent(sage.structure.category_object.CategoryObject):             # <<<<<<<<<<<<<<
 *     cdef _element_constructor
 *     cdef bint _element_init_pass_parent
 */
struct __pyx_obj_4sage_9structure_6parent_Parent {
  struct __pyx_obj_4sage_9structure_15category_object_CategoryObject __pyx_base;
  PyObject *_element_constructor;
  int _element_init_pass_parent;
  PyObject *_convert_method_name;
  PyObject *_initial_coerce_list;
  PyObject *_initial_action_list;
  PyObject *_initial_convert_list;
  int _coercions_used;
  int flags;
  PyObject *_cache_an_element;
  PyObject *_coerce_from_list;
  PyObject *_registered_domains;
  struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_coerce_from_hash;
  PyObject *_action_list;
  PyObject *_convert_from_list;
  struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_convert_from_hash;
  PyObject *_embedding;
  struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *_action_hash;
};


/* "parent_old.pxd":15
 * 
 * 
 * cdef class Parent(parent.Parent):             # <<<<<<<<<<<<<<
 *     # Cache for __has_coerce_map_from_c()
 *     cdef MonoDict _has_coerce_map_from
 */
struct __pyx_obj_4sage_9structure_10parent_old_Parent {
  struct __pyx_obj_4sage_9structure_6parent_Parent __pyx_base;
  struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_has_coerce_map_from;
};


/* "parent_base.pxd":11
 * from .parent_old cimport Parent as Parent_old
 * 
 * cdef class ParentWithBase(Parent_old):             # <<<<<<<<<<<<<<
 *     pass
 */
struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase {
  struct __pyx_obj_4sage_9structure_10parent_old_Parent __pyx_base;
};


/* "sage/structure/parent_gens.pxd":18
 * 
 * 
 * cdef class ParentWithGens(ParentWithBase):             # <<<<<<<<<<<<<<
 *     cdef public object _gens
 *     cdef public object _latex_names
 */
struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens {
  struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase __pyx_base;
  PyObject *_gens;
  PyObject *_latex_names;
  PyObject *_list;
};


/* "sage/rings/ring.pxd":5
 * cpdef bint _is_Field(x) except -2
 * 
 * cdef class Ring(ParentWithGens):             # <<<<<<<<<<<<<<
 *     cdef public object _zero_element
 *     cdef public object _one_element
 */
struct __pyx_obj_4sage_5rings_4ring_Ring {
  struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens __pyx_base;
  PyObject *_zero_element;
  PyObject *_one_element;
  PyObject *_zero_ideal;
  PyObject *_unit_ideal;
  PyObject *__ideal_monoid;
};


/* "sage/rings/ring.pxd":13
 * 
 * 
 * cdef class CommutativeRing(Ring):             # <<<<<<<<<<<<<<
 *     cdef public object __fraction_field
 * 
 */
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing {
  struct __pyx_obj_4sage_5rings_4ring_Ring __pyx_base;
  PyObject *__fraction_field;
};


/* "sage/rings/ring.pxd":16
 *     cdef public object __fraction_field
 * 
 * cdef class IntegralDomain(CommutativeRing):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain {
  struct __pyx_obj_4sage_5rings_4ring_CommutativeRing __pyx_base;
};


/* "sage/rings/ring.pxd":19
 *     pass
 * 
 * cdef class DedekindDomain(IntegralDomain):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_4ring_DedekindDomain {
  struct __pyx_obj_4sage_5rings_4ring_IntegralDomain __pyx_base;
};


/* "sage/rings/ring.pxd":23
 * 
 * 
 * cdef class PrincipalIdealDomain(IntegralDomain):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain {
  struct __pyx_obj_4sage_5rings_4ring_IntegralDomain __pyx_base;
};


/* "sage/rings/ring.pxd":26
 *     pass
 * 
 * cdef class EuclideanDomain(PrincipalIdealDomain):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_4ring_EuclideanDomain {
  struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
};


/* "sage/rings/ring.pxd":29
 *     pass
 * 
 * cdef class Field(PrincipalIdealDomain):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_4ring_Field {
  struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
};


/* "sage/rings/ring.pxd":32
 *     pass
 * 
 * cdef class Algebra(Ring):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_4ring_Algebra {
  struct __pyx_obj_4sage_5rings_4ring_Ring __pyx_base;
};


/* "sage/rings/ring.pxd":35
 *     pass
 * 
 * cdef class CommutativeAlgebra(CommutativeRing):             # <<<<<<<<<<<<<<
 *     pass
 */
struct __pyx_obj_4sage_5rings_4ring_CommutativeAlgebra {
  struct __pyx_obj_4sage_5rings_4ring_CommutativeRing __pyx_base;
};


/* "parent.pxd":103
 * 
 * 
 * cdef class Set_generic(Parent):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_6parent_Set_generic {
  struct __pyx_obj_4sage_9structure_6parent_Parent __pyx_base;
};


/* "sage/structure/element.pxd":150
 * 
 * 
 * cdef class Element(SageObject):             # <<<<<<<<<<<<<<
 *     cdef Parent _parent
 *     cpdef _richcmp_(left, right, int op)
 */
struct __pyx_obj_4sage_9structure_7element_Element {
  struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
  struct __pyx_vtabstruct_4sage_9structure_7element_Element *__pyx_vtab;
  struct __pyx_obj_4sage_9structure_6parent_Parent *_parent;
};


/* "sage/structure/element.pxd":178
 * 
 * 
 * cdef class ElementWithCachedMethod(Element):             # <<<<<<<<<<<<<<
 *     cdef public dict __cached_methods
 * 
 */
struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod {
  struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
  PyObject *__cached_methods;
};


/* "sage/structure/element.pxd":181
 *     cdef public dict __cached_methods
 * 
 * cdef class ModuleElement(Element)       # forward declaration             # <<<<<<<<<<<<<<
 * 
 * cdef class RingElement(ModuleElement)   # forward declaration
 */
struct __pyx_obj_4sage_9structure_7element_ModuleElement {
  struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
};


/* "sage/structure/element.pxd":195
 *     cpdef _rmul_(self, Element left)
 * 
 * cdef class ModuleElementWithMutability(ModuleElement):             # <<<<<<<<<<<<<<
 *     cdef bint _is_immutable
 *     cpdef bint is_immutable(self)
 */
struct __pyx_obj_4sage_9structure_7element_ModuleElementWithMutability {
  struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
  int _is_immutable;
};


/* "sage/structure/element.pxd":200
 *     cpdef bint is_mutable(self)
 * 
 * cdef class MonoidElement(Element):             # <<<<<<<<<<<<<<
 *     cpdef _pow_int(self, n)
 * 
 */
struct __pyx_obj_4sage_9structure_7element_MonoidElement {
  struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
};


/* "sage/structure/element.pxd":203
 *     cpdef _pow_int(self, n)
 * 
 * cdef class MultiplicativeGroupElement(MonoidElement):             # <<<<<<<<<<<<<<
 *     cpdef _div_(self, other)
 * 
 */
struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement {
  struct __pyx_obj_4sage_9structure_7element_MonoidElement __pyx_base;
};


/* "sage/structure/element.pxd":206
 *     cpdef _div_(self, other)
 * 
 * cdef class AdditiveGroupElement(ModuleElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement {
  struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
};


/* "sage/structure/element.pxd":183
 * cdef class ModuleElement(Element)       # forward declaration
 * 
 * cdef class RingElement(ModuleElement)   # forward declaration             # <<<<<<<<<<<<<<
 * 
 * cdef class ModuleElement(Element):
 */
struct __pyx_obj_4sage_9structure_7element_RingElement {
  struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
};


/* "sage/structure/element.pxd":214
 *     cpdef _pow_int(self, n)
 * 
 * cdef class CommutativeRingElement(RingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement {
  struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
};


/* "sage/structure/element.pxd":217
 *     pass
 * 
 * cdef class IntegralDomainElement(CommutativeRingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement {
  struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
};


/* "sage/structure/element.pxd":220
 *     pass
 * 
 * cdef class DedekindDomainElement(IntegralDomainElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement {
  struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement __pyx_base;
};


/* "sage/structure/element.pxd":223
 *     pass
 * 
 * cdef class PrincipalIdealDomainElement(DedekindDomainElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement {
  struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement __pyx_base;
};


/* "sage/structure/element.pxd":226
 *     pass
 * 
 * cdef class EuclideanDomainElement(PrincipalIdealDomainElement):             # <<<<<<<<<<<<<<
 *     cpdef _floordiv_(self, other)
 *     cpdef _mod_(self, other)
 */
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement {
  struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement __pyx_base;
};


/* "sage/structure/element.pxd":230
 *     cpdef _mod_(self, other)
 * 
 * cdef class FieldElement(CommutativeRingElement):             # <<<<<<<<<<<<<<
 *     cpdef _floordiv_(self, other)
 * 
 */
struct __pyx_obj_4sage_9structure_7element_FieldElement {
  struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
};


/* "sage/structure/element.pxd":233
 *     cpdef _floordiv_(self, other)
 * 
 * cdef class AlgebraElement(RingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_7element_AlgebraElement {
  struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
};


/* "sage/structure/element.pxd":236
 *     pass
 * 
 * cdef class CommutativeAlgebraElement(CommutativeRingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement {
  struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
};


/* "sage/structure/element.pxd":239
 *     pass
 * 
 * cdef class InfinityElement(RingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_9structure_7element_InfinityElement {
  struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
};


/* "sage/structure/element.pxd":243
 * 
 * 
 * cdef class Vector(ModuleElementWithMutability):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t _degree
 * 
 */
struct __pyx_obj_4sage_9structure_7element_Vector {
  struct __pyx_obj_4sage_9structure_7element_ModuleElementWithMutability __pyx_base;
  Py_ssize_t _degree;
};


/* "sage/structure/element.pxd":258
 * 
 * 
 * cdef class Matrix(ModuleElement):             # <<<<<<<<<<<<<<
 *     # All matrix classes must be written in Cython
 *     cdef Py_ssize_t _nrows
 */
struct __pyx_obj_4sage_9structure_7element_Matrix {
  struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
  Py_ssize_t _nrows;
  Py_ssize_t _ncols;
};


/* "sage/rings/complex_mpc.pxd":6
 * cimport sage.rings.ring
 * 
 * cdef class MPComplexNumber(sage.structure.element.FieldElement):             # <<<<<<<<<<<<<<
 *     cdef mpc_t value
 *     cdef char init
 */
struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber {
  struct __pyx_obj_4sage_9structure_7element_FieldElement __pyx_base;
  mpc_t value;
  char init;
};


/* "sage/rings/complex_mpc.pxd":13
 *     cpdef _mul_(self, other)
 * 
 * cdef class MPComplexField_class(sage.rings.ring.Field):             # <<<<<<<<<<<<<<
 *     cdef readonly int __prec
 *     cdef mpc_rnd_t __rnd
 */
struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexField_class {
  struct __pyx_obj_4sage_5rings_4ring_Field __pyx_base;
  int __prec;
  mpc_rnd_t __pyx___rnd;
  PyObject *__pyx___rnd_str;
  PyObject *__pyx___real_field;
  PyObject *__pyx___imag_field;
};


/* "sage/rings/real_mpfr.pxd":10
 * cdef class RealNumber(sage.structure.element.RingElement)  # forward decl
 * 
 * cdef class RealField_class(sage.rings.ring.Field):             # <<<<<<<<<<<<<<
 *     cdef mpfr_prec_t __prec
 *     cdef bint sci_not
 */
struct __pyx_obj_4sage_5rings_9real_mpfr_RealField_class {
  struct __pyx_obj_4sage_5rings_4ring_Field __pyx_base;
  mpfr_prec_t __pyx___prec;
  int sci_not;
  mpfr_rnd_t rnd;
  PyObject *rnd_str;
};


/* "sage/rings/real_mpfr.pxd":8
 * from sage.libs.mpfr.types cimport mpfr_prec_t
 * 
 * cdef class RealNumber(sage.structure.element.RingElement)  # forward decl             # <<<<<<<<<<<<<<
 * 
 * cdef class RealField_class(sage.rings.ring.Field):
 */
struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber {
  struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
  mpfr_t value;
};


/* "hilbert_modgroup/upper_half_plane.pxd":4
 * from sage.rings.complex_mpc cimport MPComplexField_class, MPComplexNumber
 * from sage.rings.real_mpfr cimport RealNumber
 * cdef class ComplexPlaneProductElement__class(SageObject):             # <<<<<<<<<<<<<<
 *     # cdef double *_x
 *     # cdef double *_y
 */
struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class {
  struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
  struct __pyx_vtabstruct_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *__pyx_vtab;
  int _degree;
  PyObject *_x;
  PyObject *_y;
  PyObject *_z;
  int _prec;
  int _verbose;
  struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexField_class *_base_ring;
  struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber *_norm;
  struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *_imag_norm;
  struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *_real_norm;
  struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *_abs_square_norm;
  int _norm_set;
  int _imag_norm_set;
  int _real_norm_set;
  int _abs_square_norm_set;
  int _is_in_upper_half_plane;
};


/* "hilbert_modgroup/upper_half_plane.pxd":49
 *     cpdef apply(self, m)
 * 
 * cdef class UpperHalfPlaneProductElement__class(ComplexPlaneProductElement__class):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class {
  struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class __pyx_base;
};


/* "map.pxd":4
 * from sage.structure.element cimport Element
 * 
 * cdef class Map(Element):             # <<<<<<<<<<<<<<
 *     cdef object __weakref__
 * 
 */
struct __pyx_obj_4sage_10categories_3map_Map {
  struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
  PyObject *__weakref__;
  int _coerce_cost;
  PyObject *domain;
  PyObject *codomain;
  struct __pyx_obj_4sage_9structure_6parent_Parent *_codomain;
  PyObject *_category_for;
  PyObject *_repr_type_str;
  int _is_coercion;
};


/* "map.pxd":28
 * 
 * 
 * cdef class Section(Map):             # <<<<<<<<<<<<<<
 *     cdef Map _inverse
 * 
 */
struct __pyx_obj_4sage_10categories_3map_Section {
  struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
  struct __pyx_obj_4sage_10categories_3map_Map *_inverse;
};


/* "map.pxd":31
 *     cdef Map _inverse
 * 
 * cdef class FormalCompositeMap(Map):             # <<<<<<<<<<<<<<
 *     cdef __list
 */
struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap {
  struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
  PyObject *__pyx___list;
};


/* "sage/categories/morphism.pxd":5
 * 
 * 
 * cdef class Morphism(Map):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_10categories_8morphism_Morphism {
  struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
};


/* "sage/categories/morphism.pxd":8
 *     pass
 * 
 * cdef class SetMorphism(Morphism):             # <<<<<<<<<<<<<<
 *     cdef object _function
 *     cpdef bint _eq_c_impl(left, Element right)
 */
struct __pyx_obj_4sage_10categories_8morphism_SetMorphism {
  struct __pyx_obj_4sage_10categories_8morphism_Morphism __pyx_base;
  PyObject *_function;
};


/* "sage/rings/integer.pxd":7
 * from sage.categories.morphism cimport Morphism
 * 
 * cdef class Integer(EuclideanDomainElement):             # <<<<<<<<<<<<<<
 *     # This is really of type mpz_t, but we don't use the mpz_t typedef
 *     # to work around Cython bug
 */
struct __pyx_obj_4sage_5rings_7integer_Integer {
  struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement __pyx_base;
  __mpz_struct value[1];
};


/* "sage/rings/integer.pxd":45
 *     return z
 * 
 * cdef class int_to_Z(Morphism):             # <<<<<<<<<<<<<<
 *     pass
 */
struct __pyx_obj_4sage_5rings_7integer_int_to_Z {
  struct __pyx_obj_4sage_10categories_8morphism_Morphism __pyx_base;
};


/* "sage/misc/binary_tree.pxd":27
 * 
 * 
 * cdef class BinaryTree:             # <<<<<<<<<<<<<<
 *     cdef binary_tree_node *head
 */
struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree {
  PyObject_HEAD
  struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *head;
};


/* "polynomial_compiled.pxd":7
 * cdef class generic_pd
 * 
 * cdef class CompiledPolynomialFunction:             # <<<<<<<<<<<<<<
 *     cdef generic_pd _dag
 *     cdef object _coeffs
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction {
  PyObject_HEAD
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *__pyx_vtab;
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *_dag;
  PyObject *_coeffs;
};


/* "polynomial_compiled.pxd":5
 * 
 * 
 * cdef class generic_pd             # <<<<<<<<<<<<<<
 * 
 * cdef class CompiledPolynomialFunction:
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd {
  PyObject_HEAD
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *__pyx_vtab;
  PyObject *value;
  int refs;
  int hits;
  int label;
};


/* "polynomial_compiled.pxd":24
 *     cdef void reset(self)
 * 
 * cdef class dummy_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef generic_pd link
 *     cdef void fill(dummy_pd self, generic_pd link)
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *link;
};


/* "polynomial_compiled.pxd":28
 *     cdef void fill(dummy_pd self, generic_pd link)
 * 
 * cdef class var_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef int index
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_var_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
  int index;
};


/* "polynomial_compiled.pxd":31
 *     cdef int index
 * 
 * cdef class univar_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
};


/* "polynomial_compiled.pxd":34
 *     pass
 * 
 * cdef class coeff_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef int index
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
  int index;
};


/* "polynomial_compiled.pxd":38
 * 
 * 
 * cdef class unary_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef generic_pd operand
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *operand;
};


/* "polynomial_compiled.pxd":41
 *     cdef generic_pd operand
 * 
 * cdef class sqr_pd(unary_pd):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
};


/* "polynomial_compiled.pxd":44
 *     pass
 * 
 * cdef class pow_pd(unary_pd):             # <<<<<<<<<<<<<<
 *     cdef object exponent
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
  PyObject *exponent;
};


/* "polynomial_compiled.pxd":48
 * 
 * 
 * cdef class binary_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef generic_pd left, right
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *left;
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *right;
};


/* "polynomial_compiled.pxd":51
 *     cdef generic_pd left, right
 * 
 * cdef class add_pd(binary_pd):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_add_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
};


/* "polynomial_compiled.pxd":54
 *     pass
 * 
 * cdef class mul_pd(binary_pd):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
};


/* "polynomial_compiled.pxd":57
 *     pass
 * 
 * cdef class abc_pd(binary_pd):             # <<<<<<<<<<<<<<
 *     cdef int index
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd {
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
  int index;
};


/* "sage/rings/polynomial/polynomial_element.pxd":8
 * 
 * 
 * cdef class Polynomial(CommutativeAlgebraElement):             # <<<<<<<<<<<<<<
 *     cdef Polynomial _new_generic(self, list coeffs)
 *     cdef char _is_gen
 */
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial {
  struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement __pyx_base;
  char _is_gen;
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *_compiled;
  PyObject *__cached_methods;
};


/* "sage/rings/polynomial/polynomial_element.pxd":49
 *     cdef public dict __cached_methods
 * 
 * cdef class Polynomial_generic_dense(Polynomial):             # <<<<<<<<<<<<<<
 *     cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P)
 *     cdef list __coeffs
 */
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense {
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial __pyx_base;
  PyObject *__pyx___coeffs;
};


/* "sage/rings/polynomial/polynomial_element.pxd":55
 *     cpdef list list(self, bint copy=*)
 * 
 * cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact {
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense __pyx_base;
};


/* "sage/libs/ntl/ntl_ZZX.pxd":3
 * from .types cimport ZZX_c
 * 
 * cdef class ntl_ZZX(object):             # <<<<<<<<<<<<<<
 *     cdef ZZX_c x
 *     cdef void setitem_from_int(ntl_ZZX self, long i, int value)
 */
struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX {
  PyObject_HEAD
  struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx_vtab;
  ZZX x;
};


/* "sage/libs/ntl/ntl_ZZ.pxd":3
 * from sage.libs.ntl.types cimport ZZ_c
 * 
 * cdef class ntl_ZZ(object):             # <<<<<<<<<<<<<<
 *     cdef ZZ_c x
 *     cdef int get_as_int(ntl_ZZ self)
 */
struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ {
  PyObject_HEAD
  struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx_vtab;
  ZZ x;
};


/* "sage/rings/number_field/number_field_element.pxd":11
 * from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
 * 
 * cdef class NumberFieldElement(FieldElement):             # <<<<<<<<<<<<<<
 *     cdef ZZX_c __numerator
 *     cdef ZZ_c __denominator
 */
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement {
  struct __pyx_obj_4sage_9structure_7element_FieldElement __pyx_base;
  ZZX __pyx___numerator;
  ZZ __pyx___denominator;
  struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx___fld_numerator;
  struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx___fld_denominator;
  PyObject *__pyx___multiplicative_order;
  PyObject *__pyx___pari;
  PyObject *__pyx___matrix;
};


/* "sage/rings/number_field/number_field_element.pxd":43
 * 
 * 
 * cdef class NumberFieldElement_absolute(NumberFieldElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute {
  struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
};


/* "sage/rings/number_field/number_field_element.pxd":46
 *     pass
 * 
 * cdef class NumberFieldElement_relative(NumberFieldElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative {
  struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
};


/* "sage/rings/number_field/number_field_element.pxd":51
 * # TODO: cyclotomic and/or quadratic classes? (Both for differing implementations and speed).
 * 
 * cdef class OrderElement_absolute(NumberFieldElement_absolute):             # <<<<<<<<<<<<<<
 *     cdef object _number_field
 * 
 */
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute {
  struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
  PyObject *_number_field;
};


/* "sage/rings/number_field/number_field_element.pxd":54
 *     cdef object _number_field
 * 
 * cdef class OrderElement_relative(NumberFieldElement_relative):             # <<<<<<<<<<<<<<
 *     cdef object _number_field
 */
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_relative {
  struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative __pyx_base;
  PyObject *_number_field;
};



/* "sage/structure/category_object.pxd":15
 * cpdef check_default_category(default_category, category)
 * 
 * cdef class CategoryObject(SageObject):             # <<<<<<<<<<<<<<
 *     cdef public dict __cached_methods
 *     cdef _category
 */

struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject {
  PyObject *(*getattr_from_category)(struct __pyx_obj_4sage_9structure_15category_object_CategoryObject *, PyObject *);
};
static struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject *__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject;


/* "sage/structure/coerce_dict.pxd":12
 * 
 * @cython.final
 * cdef class MonoDict:             # <<<<<<<<<<<<<<
 *     cdef __weakref__
 *     cdef size_t mask  # size - 1 with 'size' the length of the table array
 */

struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict {
  struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell *(*lookup)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *);
  PyObject *(*get)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *);
  int (*set)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *, PyObject *);
  int (*resize)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *);
};
static struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict *__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict;


/* "sage/structure/coerce_dict.pxd":38
 * 
 * @cython.final
 * cdef class TripleDict:             # <<<<<<<<<<<<<<
 *     cdef __weakref__
 *     cdef size_t mask  # size - 1 with 'size' the length of the table array
 */

struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict {
  struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell *(*lookup)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *);
  PyObject *(*get)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *);
  int (*set)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *, PyObject *);
  int (*resize)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *);
};
static struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict *__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict;


/* "parent.pxd":12
 * from sage.structure.coerce_dict cimport MonoDict, TripleDict
 * 
 * cdef class Parent(sage.structure.category_object.CategoryObject):             # <<<<<<<<<<<<<<
 *     cdef _element_constructor
 *     cdef bint _element_init_pass_parent
 */

struct __pyx_vtabstruct_4sage_9structure_6parent_Parent {
  struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject __pyx_base;
  int (*get_flag)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int);
  PyObject *(*register_coercion)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*register_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*register_conversion)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*register_embedding)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  int (*is_exact)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
  int (*init_coerce)(struct __pyx_obj_4sage_9structure_6parent_Parent *, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce *__pyx_optional_args);
  int (*has_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_internal_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_coerce_map_from_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_internal_convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_convert_map_from_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*convert_method_map)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, PyObject *);
  PyObject *(*get_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action *__pyx_optional_args);
  PyObject *(*_get_action_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
  PyObject *(*coerce)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*an_element)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
  PyObject *(*_generic_convert_map)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_9structure_6parent_6Parent__generic_convert_map *__pyx_optional_args);
  PyObject *(*_generic_coerce_map)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*discover_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *);
  PyObject *(*discover_convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *);
  PyObject *(*discover_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, PyObject *, int, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action *__pyx_optional_args);
};
static struct __pyx_vtabstruct_4sage_9structure_6parent_Parent *__pyx_vtabptr_4sage_9structure_6parent_Parent;
static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *, int);


/* "parent_old.pxd":15
 * 
 * 
 * cdef class Parent(parent.Parent):             # <<<<<<<<<<<<<<
 *     # Cache for __has_coerce_map_from_c()
 *     cdef MonoDict _has_coerce_map_from
 */

struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent {
  struct __pyx_vtabstruct_4sage_9structure_6parent_Parent __pyx_base;
  PyObject *(*_coerce_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_coerce_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
  PyObject *(*__pyx___coerce_map_from_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
  PyObject *(*__pyx___coerce_map_from_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
  PyObject *(*__pyx___has_coerce_map_from_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
};
static struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent *__pyx_vtabptr_4sage_9structure_10parent_old_Parent;


/* "parent_base.pxd":11
 * from .parent_old cimport Parent as Parent_old
 * 
 * cdef class ParentWithBase(Parent_old):             # <<<<<<<<<<<<<<
 *     pass
 */

struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase {
  struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase *__pyx_vtabptr_4sage_9structure_11parent_base_ParentWithBase;


/* "sage/structure/parent_gens.pxd":18
 * 
 * 
 * cdef class ParentWithGens(ParentWithBase):             # <<<<<<<<<<<<<<
 *     cdef public object _gens
 *     cdef public object _latex_names
 */

struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens {
  struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens *__pyx_vtabptr_4sage_9structure_11parent_gens_ParentWithGens;


/* "sage/rings/ring.pxd":5
 * cpdef bint _is_Field(x) except -2
 * 
 * cdef class Ring(ParentWithGens):             # <<<<<<<<<<<<<<
 *     cdef public object _zero_element
 *     cdef public object _one_element
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_Ring {
  struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_Ring *__pyx_vtabptr_4sage_5rings_4ring_Ring;


/* "sage/rings/ring.pxd":13
 * 
 * 
 * cdef class CommutativeRing(Ring):             # <<<<<<<<<<<<<<
 *     cdef public object __fraction_field
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing {
  struct __pyx_vtabstruct_4sage_5rings_4ring_Ring __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing *__pyx_vtabptr_4sage_5rings_4ring_CommutativeRing;


/* "sage/rings/ring.pxd":16
 *     cdef public object __fraction_field
 * 
 * cdef class IntegralDomain(CommutativeRing):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain {
  struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain *__pyx_vtabptr_4sage_5rings_4ring_IntegralDomain;


/* "sage/rings/ring.pxd":19
 *     pass
 * 
 * cdef class DedekindDomain(IntegralDomain):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_DedekindDomain {
  struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_DedekindDomain *__pyx_vtabptr_4sage_5rings_4ring_DedekindDomain;


/* "sage/rings/ring.pxd":23
 * 
 * 
 * cdef class PrincipalIdealDomain(IntegralDomain):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain {
  struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain *__pyx_vtabptr_4sage_5rings_4ring_PrincipalIdealDomain;


/* "sage/rings/ring.pxd":26
 *     pass
 * 
 * cdef class EuclideanDomain(PrincipalIdealDomain):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_EuclideanDomain {
  struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_EuclideanDomain *__pyx_vtabptr_4sage_5rings_4ring_EuclideanDomain;


/* "sage/rings/ring.pxd":29
 *     pass
 * 
 * cdef class Field(PrincipalIdealDomain):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_Field {
  struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_Field *__pyx_vtabptr_4sage_5rings_4ring_Field;


/* "sage/rings/ring.pxd":32
 *     pass
 * 
 * cdef class Algebra(Ring):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_Algebra {
  struct __pyx_vtabstruct_4sage_5rings_4ring_Ring __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_Algebra *__pyx_vtabptr_4sage_5rings_4ring_Algebra;


/* "sage/rings/ring.pxd":35
 *     pass
 * 
 * cdef class CommutativeAlgebra(CommutativeRing):             # <<<<<<<<<<<<<<
 *     pass
 */

struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeAlgebra {
  struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeAlgebra *__pyx_vtabptr_4sage_5rings_4ring_CommutativeAlgebra;


/* "parent.pxd":103
 * 
 * 
 * cdef class Set_generic(Parent):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_6parent_Set_generic {
  struct __pyx_vtabstruct_4sage_9structure_6parent_Parent __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_6parent_Set_generic *__pyx_vtabptr_4sage_9structure_6parent_Set_generic;


/* "sage/structure/element.pxd":150
 * 
 * 
 * cdef class Element(SageObject):             # <<<<<<<<<<<<<<
 *     cdef Parent _parent
 *     cpdef _richcmp_(left, right, int op)
 */

struct __pyx_vtabstruct_4sage_9structure_7element_Element {
  PyObject *(*_richcmp_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
  int (*_cmp_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*base_extend)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*getattr_from_category)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_act_on_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
  PyObject *(*_acted_upon_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
  PyObject *(*_add_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_sub_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_neg_)(struct __pyx_obj_4sage_9structure_7element_Element *);
  PyObject *(*_add_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
  PyObject *(*_mul_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_mul_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
  PyObject *(*_matmul_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_mod_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_pow_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_pow_int)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
  PyObject *(*_pow_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_Element *__pyx_vtabptr_4sage_9structure_7element_Element;


/* "sage/structure/element.pxd":178
 * 
 * 
 * cdef class ElementWithCachedMethod(Element):             # <<<<<<<<<<<<<<
 *     cdef public dict __cached_methods
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod {
  struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod *__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod;


/* "sage/structure/element.pxd":181
 *     cdef public dict __cached_methods
 * 
 * cdef class ModuleElement(Element)       # forward declaration             # <<<<<<<<<<<<<<
 * 
 * cdef class RingElement(ModuleElement)   # forward declaration
 */

struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
  PyObject *(*_add_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_sub_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_neg_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, int __pyx_skip_dispatch);
  PyObject *(*_lmul_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, struct __pyx_obj_4sage_9structure_7element_Element *, int __pyx_skip_dispatch);
  PyObject *(*_rmul_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, struct __pyx_obj_4sage_9structure_7element_Element *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement *__pyx_vtabptr_4sage_9structure_7element_ModuleElement;


/* "sage/structure/element.pxd":183
 * cdef class ModuleElement(Element)       # forward declaration
 * 
 * cdef class RingElement(ModuleElement)   # forward declaration             # <<<<<<<<<<<<<<
 * 
 * cdef class ModuleElement(Element):
 */

struct __pyx_vtabstruct_4sage_9structure_7element_RingElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
  PyObject *(*_mul_)(struct __pyx_obj_4sage_9structure_7element_RingElement *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_RingElement *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_pow_int)(struct __pyx_obj_4sage_9structure_7element_RingElement *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_RingElement *__pyx_vtabptr_4sage_9structure_7element_RingElement;


/* "sage/structure/element.pxd":195
 *     cpdef _rmul_(self, Element left)
 * 
 * cdef class ModuleElementWithMutability(ModuleElement):             # <<<<<<<<<<<<<<
 *     cdef bint _is_immutable
 *     cpdef bint is_immutable(self)
 */

struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElementWithMutability {
  struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
  int (*is_immutable)(struct __pyx_obj_4sage_9structure_7element_ModuleElementWithMutability *, int __pyx_skip_dispatch);
  int (*is_mutable)(struct __pyx_obj_4sage_9structure_7element_ModuleElementWithMutability *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElementWithMutability *__pyx_vtabptr_4sage_9structure_7element_ModuleElementWithMutability;


/* "sage/structure/element.pxd":200
 *     cpdef bint is_mutable(self)
 * 
 * cdef class MonoidElement(Element):             # <<<<<<<<<<<<<<
 *     cpdef _pow_int(self, n)
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
  PyObject *(*_pow_int)(struct __pyx_obj_4sage_9structure_7element_MonoidElement *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement *__pyx_vtabptr_4sage_9structure_7element_MonoidElement;


/* "sage/structure/element.pxd":203
 *     cpdef _pow_int(self, n)
 * 
 * cdef class MultiplicativeGroupElement(MonoidElement):             # <<<<<<<<<<<<<<
 *     cpdef _div_(self, other)
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement __pyx_base;
  PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement *__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement;


/* "sage/structure/element.pxd":206
 *     cpdef _div_(self, other)
 * 
 * cdef class AdditiveGroupElement(ModuleElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement *__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement;


/* "sage/structure/element.pxd":214
 *     cpdef _pow_int(self, n)
 * 
 * cdef class CommutativeRingElement(RingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement *__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement;


/* "sage/structure/element.pxd":217
 *     pass
 * 
 * cdef class IntegralDomainElement(CommutativeRingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement *__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement;


/* "sage/structure/element.pxd":220
 *     pass
 * 
 * cdef class DedekindDomainElement(IntegralDomainElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement *__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement;


/* "sage/structure/element.pxd":223
 *     pass
 * 
 * cdef class PrincipalIdealDomainElement(DedekindDomainElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement *__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement;


/* "sage/structure/element.pxd":226
 *     pass
 * 
 * cdef class EuclideanDomainElement(PrincipalIdealDomainElement):             # <<<<<<<<<<<<<<
 *     cpdef _floordiv_(self, other)
 *     cpdef _mod_(self, other)
 */

struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement __pyx_base;
  PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_mod_)(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement *__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement;


/* "sage/structure/element.pxd":230
 *     cpdef _mod_(self, other)
 * 
 * cdef class FieldElement(CommutativeRingElement):             # <<<<<<<<<<<<<<
 *     cpdef _floordiv_(self, other)
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
  PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_FieldElement *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement *__pyx_vtabptr_4sage_9structure_7element_FieldElement;


/* "sage/structure/element.pxd":233
 *     cpdef _floordiv_(self, other)
 * 
 * cdef class AlgebraElement(RingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement *__pyx_vtabptr_4sage_9structure_7element_AlgebraElement;


/* "sage/structure/element.pxd":236
 *     pass
 * 
 * cdef class CommutativeAlgebraElement(CommutativeRingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement *__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement;


/* "sage/structure/element.pxd":239
 *     pass
 * 
 * cdef class InfinityElement(RingElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement *__pyx_vtabptr_4sage_9structure_7element_InfinityElement;


/* "sage/structure/element.pxd":243
 * 
 * 
 * cdef class Vector(ModuleElementWithMutability):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t _degree
 * 
 */

struct __pyx_vtabstruct_4sage_9structure_7element_Vector {
  struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElementWithMutability __pyx_base;
  PyObject *(*_dot_product_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
  PyObject *(*_dot_product_coerce_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
  PyObject *(*_pairwise_product_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
  int (*is_sparse_c)(struct __pyx_obj_4sage_9structure_7element_Vector *);
  int (*is_dense_c)(struct __pyx_obj_4sage_9structure_7element_Vector *);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_Vector *__pyx_vtabptr_4sage_9structure_7element_Vector;


/* "sage/structure/element.pxd":258
 * 
 * 
 * cdef class Matrix(ModuleElement):             # <<<<<<<<<<<<<<
 *     # All matrix classes must be written in Cython
 *     cdef Py_ssize_t _nrows
 */

struct __pyx_vtabstruct_4sage_9structure_7element_Matrix {
  struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
  PyObject *(*_vector_times_matrix_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Vector *);
  PyObject *(*_matrix_times_vector_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Vector *);
  PyObject *(*_matrix_times_matrix_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Matrix *);
  int (*is_sparse_c)(struct __pyx_obj_4sage_9structure_7element_Matrix *);
  int (*is_dense_c)(struct __pyx_obj_4sage_9structure_7element_Matrix *);
};
static struct __pyx_vtabstruct_4sage_9structure_7element_Matrix *__pyx_vtabptr_4sage_9structure_7element_Matrix;


/* "sage/rings/complex_mpc.pxd":6
 * cimport sage.rings.ring
 * 
 * cdef class MPComplexNumber(sage.structure.element.FieldElement):             # <<<<<<<<<<<<<<
 *     cdef mpc_t value
 *     cdef char init
 */

struct __pyx_vtabstruct_4sage_5rings_11complex_mpc_MPComplexNumber {
  struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement __pyx_base;
  struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber *(*_new)(struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber *);
};
static struct __pyx_vtabstruct_4sage_5rings_11complex_mpc_MPComplexNumber *__pyx_vtabptr_4sage_5rings_11complex_mpc_MPComplexNumber;


/* "sage/rings/complex_mpc.pxd":13
 *     cpdef _mul_(self, other)
 * 
 * cdef class MPComplexField_class(sage.rings.ring.Field):             # <<<<<<<<<<<<<<
 *     cdef readonly int __prec
 *     cdef mpc_rnd_t __rnd
 */

struct __pyx_vtabstruct_4sage_5rings_11complex_mpc_MPComplexField_class {
  struct __pyx_vtabstruct_4sage_5rings_4ring_Field __pyx_base;
  struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber *(*_new)(struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexField_class *);
  PyObject *(*_an_element_)(struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexField_class *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_5rings_11complex_mpc_MPComplexField_class *__pyx_vtabptr_4sage_5rings_11complex_mpc_MPComplexField_class;


/* "sage/rings/real_mpfr.pxd":8
 * from sage.libs.mpfr.types cimport mpfr_prec_t
 * 
 * cdef class RealNumber(sage.structure.element.RingElement)  # forward decl             # <<<<<<<<<<<<<<
 * 
 * cdef class RealField_class(sage.rings.ring.Field):
 */

struct __pyx_vtabstruct_4sage_5rings_9real_mpfr_RealNumber {
  struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
  struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *(*_new)(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *);
  PyObject *(*_mod_)(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_set)(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *, PyObject *, int);
  PyObject *(*_set_from_GEN_REAL)(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *, GEN);
  struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *(*abs)(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *);
};
static struct __pyx_vtabstruct_4sage_5rings_9real_mpfr_RealNumber *__pyx_vtabptr_4sage_5rings_9real_mpfr_RealNumber;
static CYTHON_INLINE struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_f_4sage_5rings_9real_mpfr_10RealNumber__new(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *);


/* "sage/rings/real_mpfr.pxd":10
 * cdef class RealNumber(sage.structure.element.RingElement)  # forward decl
 * 
 * cdef class RealField_class(sage.rings.ring.Field):             # <<<<<<<<<<<<<<
 *     cdef mpfr_prec_t __prec
 *     cdef bint sci_not
 */

struct __pyx_vtabstruct_4sage_5rings_9real_mpfr_RealField_class {
  struct __pyx_vtabstruct_4sage_5rings_4ring_Field __pyx_base;
  struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *(*_new)(struct __pyx_obj_4sage_5rings_9real_mpfr_RealField_class *);
};
static struct __pyx_vtabstruct_4sage_5rings_9real_mpfr_RealField_class *__pyx_vtabptr_4sage_5rings_9real_mpfr_RealField_class;
static CYTHON_INLINE struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_f_4sage_5rings_9real_mpfr_15RealField_class__new(struct __pyx_obj_4sage_5rings_9real_mpfr_RealField_class *);


/* "hilbert_modgroup/upper_half_plane.pxd":4
 * from sage.rings.complex_mpc cimport MPComplexField_class, MPComplexNumber
 * from sage.rings.real_mpfr cimport RealNumber
 * cdef class ComplexPlaneProductElement__class(SageObject):             # <<<<<<<<<<<<<<
 *     # cdef double *_x
 *     # cdef double *_y
 */

struct __pyx_vtabstruct_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class {
  PyObject *(*imag)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*real)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*_sub)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_add)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_mul)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_div)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_is_equal)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*__pyx___copy__)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*z)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*set_prec)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*abs)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*imag_norm)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*real_norm)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*abs_square_norm)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*imag_trace)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*real_trace)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*trace)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*reflect)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*prec)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*norm)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*vector)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch);
  PyObject *(*vector_norm)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, int __pyx_skip_dispatch, struct __pyx_opt_args_16hilbert_modgroup_16upper_half_plane_33ComplexPlaneProductElement__class_vector_norm *__pyx_optional_args);
  PyObject *(*apply)(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class *__pyx_vtabptr_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class;


/* "hilbert_modgroup/upper_half_plane.pxd":49
 *     cpdef apply(self, m)
 * 
 * cdef class UpperHalfPlaneProductElement__class(ComplexPlaneProductElement__class):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class {
  struct __pyx_vtabstruct_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class __pyx_base;
};
static struct __pyx_vtabstruct_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *__pyx_vtabptr_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class;


/* "map.pxd":4
 * from sage.structure.element cimport Element
 * 
 * cdef class Map(Element):             # <<<<<<<<<<<<<<
 *     cdef object __weakref__
 * 
 */

struct __pyx_vtabstruct_4sage_10categories_3map_Map {
  struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
  PyObject *(*_update_slots)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *);
  PyObject *(*_extra_slots)(struct __pyx_obj_4sage_10categories_3map_Map *);
  struct __pyx_obj_4sage_9structure_7element_Element *(*_call_)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_4sage_9structure_7element_Element *(*_call_with_args)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args *__pyx_optional_args);
  PyObject *(*_pow_int)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_10categories_3map_Map *__pyx_vtabptr_4sage_10categories_3map_Map;


/* "map.pxd":28
 * 
 * 
 * cdef class Section(Map):             # <<<<<<<<<<<<<<
 *     cdef Map _inverse
 * 
 */

struct __pyx_vtabstruct_4sage_10categories_3map_Section {
  struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
};
static struct __pyx_vtabstruct_4sage_10categories_3map_Section *__pyx_vtabptr_4sage_10categories_3map_Section;


/* "map.pxd":31
 *     cdef Map _inverse
 * 
 * cdef class FormalCompositeMap(Map):             # <<<<<<<<<<<<<<
 *     cdef __list
 */

struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap {
  struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
};
static struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap *__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap;


/* "sage/categories/morphism.pxd":5
 * 
 * 
 * cdef class Morphism(Map):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism {
  struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
};
static struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism *__pyx_vtabptr_4sage_10categories_8morphism_Morphism;


/* "sage/categories/morphism.pxd":8
 *     pass
 * 
 * cdef class SetMorphism(Morphism):             # <<<<<<<<<<<<<<
 *     cdef object _function
 *     cpdef bint _eq_c_impl(left, Element right)
 */

struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism {
  struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism __pyx_base;
  int (*_eq_c_impl)(struct __pyx_obj_4sage_10categories_8morphism_SetMorphism *, struct __pyx_obj_4sage_9structure_7element_Element *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism *__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism;


/* "sage/rings/integer.pxd":7
 * from sage.categories.morphism cimport Morphism
 * 
 * cdef class Integer(EuclideanDomainElement):             # <<<<<<<<<<<<<<
 *     # This is really of type mpz_t, but we don't use the mpz_t typedef
 *     # to work around Cython bug
 */

struct __pyx_vtabstruct_4sage_5rings_7integer_Integer {
  struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement __pyx_base;
  void (*set_from_mpz)(struct __pyx_obj_4sage_5rings_7integer_Integer *, __mpz_struct *);
  PyObject *(*hash_c)(struct __pyx_obj_4sage_5rings_7integer_Integer *);
  PyObject *(*__pyx___pari__)(struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
  PyObject *(*_shift_helper)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int, int __pyx_skip_dispatch);
  PyObject *(*_pow_)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_and)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
  PyObject *(*_or)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
  PyObject *(*_xor)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
  size_t (*_exact_log_log2_iter)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
  size_t (*_exact_log_mpfi_log)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_4sage_9structure_7element_RingElement *(*_valuation)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
  PyObject *(*_val_unit)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
  struct __pyx_obj_4sage_5rings_7integer_Integer *(*_divide_knowing_divisible_by)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
  int (*_is_power_of)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
  int (*_pseudoprime_is_prime)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *);
  PyObject *(*_pari_divisors_small)(struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_5rings_7integer_Integer *__pyx_vtabptr_4sage_5rings_7integer_Integer;


/* "sage/rings/integer.pxd":45
 *     return z
 * 
 * cdef class int_to_Z(Morphism):             # <<<<<<<<<<<<<<
 *     pass
 */

struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z {
  struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z *__pyx_vtabptr_4sage_5rings_7integer_int_to_Z;


/* "polynomial_compiled.pxd":5
 * 
 * 
 * cdef class generic_pd             # <<<<<<<<<<<<<<
 * 
 * cdef class CompiledPolynomialFunction:
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd {
  int (*eval)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *, PyObject *, PyObject *);
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *(*nodummies)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
  void (*reset)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd;


/* "polynomial_compiled.pxd":7
 * cdef class generic_pd
 * 
 * cdef class CompiledPolynomialFunction:             # <<<<<<<<<<<<<<
 *     cdef generic_pd _dag
 *     cdef object _coeffs
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction {
  PyObject *(*_parse_structure)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *);
  struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *(*_get_gap)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *, struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree *, int);
  void (*_fill_gaps_binary)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *, struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree *);
  PyObject *(*eval)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *, PyObject *);
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction;


/* "polynomial_compiled.pxd":24
 *     cdef void reset(self)
 * 
 * cdef class dummy_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef generic_pd link
 *     cdef void fill(dummy_pd self, generic_pd link)
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
  void (*fill)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd *, struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd;


/* "polynomial_compiled.pxd":28
 *     cdef void fill(dummy_pd self, generic_pd link)
 * 
 * cdef class var_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef int index
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_var_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_var_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_var_pd;


/* "polynomial_compiled.pxd":31
 *     cdef int index
 * 
 * cdef class univar_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd;


/* "polynomial_compiled.pxd":34
 *     pass
 * 
 * cdef class coeff_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef int index
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd;


/* "polynomial_compiled.pxd":38
 * 
 * 
 * cdef class unary_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef generic_pd operand
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd;


/* "polynomial_compiled.pxd":41
 *     cdef generic_pd operand
 * 
 * cdef class sqr_pd(unary_pd):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd;


/* "polynomial_compiled.pxd":44
 *     pass
 * 
 * cdef class pow_pd(unary_pd):             # <<<<<<<<<<<<<<
 *     cdef object exponent
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd;


/* "polynomial_compiled.pxd":48
 * 
 * 
 * cdef class binary_pd(generic_pd):             # <<<<<<<<<<<<<<
 *     cdef generic_pd left, right
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd;


/* "polynomial_compiled.pxd":51
 *     cdef generic_pd left, right
 * 
 * cdef class add_pd(binary_pd):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_add_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_add_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_add_pd;


/* "polynomial_compiled.pxd":54
 *     pass
 * 
 * cdef class mul_pd(binary_pd):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd;


/* "polynomial_compiled.pxd":57
 *     pass
 * 
 * cdef class abc_pd(binary_pd):             # <<<<<<<<<<<<<<
 *     cdef int index
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd;


/* "sage/rings/polynomial/polynomial_element.pxd":8
 * 
 * 
 * cdef class Polynomial(CommutativeAlgebraElement):             # <<<<<<<<<<<<<<
 *     cdef Polynomial _new_generic(self, list coeffs)
 *     cdef char _is_gen
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial {
  struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement __pyx_base;
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*_new_generic)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, PyObject *);
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*truncate)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long, int __pyx_skip_dispatch);
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*inverse_series_trunc)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long, int __pyx_skip_dispatch);
  long (*_hash_c)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *);
  PyObject *(*constant_coefficient)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*_new_constant_poly)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, PyObject *, struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
  PyObject *(*list)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_5rings_10polynomial_18polynomial_element_10Polynomial_list *__pyx_optional_args);
  PyObject *(*_mul_generic)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_square_generic)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *);
  int (*is_zero)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
  int (*is_one)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
  int (*is_term)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
  PyObject *(*_mpoly_dict_recursive)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_5rings_10polynomial_18polynomial_element_10Polynomial__mpoly_dict_recursive *__pyx_optional_args);
  PyObject *(*_floordiv_)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*_mul_trunc_)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long, int __pyx_skip_dispatch);
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*_power_trunc)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, unsigned long, long, int __pyx_skip_dispatch);
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*_mul_term)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int);
  PyObject *(*_inplace_truncate)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long);
  PyObject *(*get_coeff_c)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, Py_ssize_t);
  PyObject *(*get_unsafe)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, Py_ssize_t);
  long (*number_of_terms)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial;


/* "sage/rings/polynomial/polynomial_element.pxd":49
 *     cdef public dict __cached_methods
 * 
 * cdef class Polynomial_generic_dense(Polynomial):             # <<<<<<<<<<<<<<
 *     cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P)
 *     cdef list __coeffs
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial __pyx_base;
  struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *(*_new_c)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *, PyObject *, struct __pyx_obj_4sage_9structure_6parent_Parent *);
  int (*__pyx___normalize)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *);
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense;


/* "sage/rings/polynomial/polynomial_element.pxd":55
 *     cpdef list list(self, bint copy=*)
 * 
 * cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact {
  struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact;


/* "sage/libs/ntl/ntl_ZZX.pxd":3
 * from .types cimport ZZX_c
 * 
 * cdef class ntl_ZZX(object):             # <<<<<<<<<<<<<<
 *     cdef ZZX_c x
 *     cdef void setitem_from_int(ntl_ZZX self, long i, int value)
 */

struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX {
  void (*setitem_from_int)(struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *, long, int);
  int (*getitem_as_int)(struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *, long);
};
static struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx_vtabptr_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX;


/* "sage/libs/ntl/ntl_ZZ.pxd":3
 * from sage.libs.ntl.types cimport ZZ_c
 * 
 * cdef class ntl_ZZ(object):             # <<<<<<<<<<<<<<
 *     cdef ZZ_c x
 *     cdef int get_as_int(ntl_ZZ self)
 */

struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ {
  int (*get_as_int)(struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *);
  void (*set_from_int)(struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *, int);
};
static struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx_vtabptr_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ;


/* "sage/rings/number_field/number_field_element.pxd":11
 * from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
 * 
 * cdef class NumberFieldElement(FieldElement):             # <<<<<<<<<<<<<<
 *     cdef ZZX_c __numerator
 *     cdef ZZ_c __denominator
 */

struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement {
  struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement __pyx_base;
  PyObject *(*_new)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
  PyObject *(*number_field)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
  void (*_ntl_coeff_as_mpz)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, __mpz_struct *, long);
  void (*_ntl_denom_as_mpz)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, __mpz_struct *);
  void (*_reduce_c_)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
  PyObject *(*_coefficients)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
  int (*is_rational)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
  int (*is_one)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
  int (*_randomize)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, PyObject *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement;


/* "sage/rings/number_field/number_field_element.pxd":43
 * 
 * 
 * cdef class NumberFieldElement_absolute(NumberFieldElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute {
  struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute;


/* "sage/rings/number_field/number_field_element.pxd":46
 *     pass
 * 
 * cdef class NumberFieldElement_relative(NumberFieldElement):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative {
  struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative;


/* "sage/rings/number_field/number_field_element.pxd":51
 * # TODO: cyclotomic and/or quadratic classes? (Both for differing implementations and speed).
 * 
 * cdef class OrderElement_absolute(NumberFieldElement_absolute):             # <<<<<<<<<<<<<<
 *     cdef object _number_field
 * 
 */

struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute {
  struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute;


/* "sage/rings/number_field/number_field_element.pxd":54
 *     cdef object _number_field
 * 
 * cdef class OrderElement_relative(NumberFieldElement_relative):             # <<<<<<<<<<<<<<
 *     cdef object _number_field
 */

struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_relative {
  struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative __pyx_base;
};
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_relative *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_relative;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* Profile.proto */
#ifndef CYTHON_PROFILE
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
  #define CYTHON_PROFILE 0
#else
  #define CYTHON_PROFILE 1
#endif
#endif
#ifndef CYTHON_TRACE_NOGIL
  #define CYTHON_TRACE_NOGIL 0
#else
  #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
    #define CYTHON_TRACE 1
  #endif
#endif
#ifndef CYTHON_TRACE
  #define CYTHON_TRACE 0
#endif
#if CYTHON_TRACE
  #undef CYTHON_PROFILE_REUSE_FRAME
#endif
#ifndef CYTHON_PROFILE_REUSE_FRAME
  #define CYTHON_PROFILE_REUSE_FRAME 0
#endif
#if CYTHON_PROFILE || CYTHON_TRACE
  #include "compile.h"
  #include "frameobject.h"
  #include "traceback.h"
  #if CYTHON_PROFILE_REUSE_FRAME
    #define CYTHON_FRAME_MODIFIER static
    #define CYTHON_FRAME_DEL(frame)
  #else
    #define CYTHON_FRAME_MODIFIER
    #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
  #endif
  #define __Pyx_TraceDeclarations\
  static PyCodeObject *__pyx_frame_code = NULL;\
  CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
  int __Pyx_use_tracing = 0;
  #define __Pyx_TraceFrameInit(codeobj)\
  if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
  #ifdef WITH_THREAD
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  if (nogil) {\
      if (CYTHON_TRACE_NOGIL) {\
          PyThreadState *tstate;\
          PyGILState_STATE state = PyGILState_Ensure();\
          tstate = __Pyx_PyThreadState_Current;\
          if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
                  (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
              __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          }\
          PyGILState_Release(state);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  } else {\
      PyThreadState* tstate = PyThreadState_GET();\
      if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
              (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #else
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  {   PyThreadState* tstate = PyThreadState_GET();\
      if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
              (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #endif
  #define __Pyx_TraceException()\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (tstate->use_tracing &&\
              (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
          tstate->tracing++;\
          tstate->use_tracing = 0;\
          PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
          if (exc_info) {\
              if (CYTHON_TRACE && tstate->c_tracefunc)\
                  tstate->c_tracefunc(\
                      tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
              tstate->c_profilefunc(\
                  tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
              Py_DECREF(exc_info);\
          }\
          tstate->use_tracing = 1;\
          tstate->tracing--;\
      }\
  }
  static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
      PyObject *type, *value, *traceback;
      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
      tstate->tracing++;
      tstate->use_tracing = 0;
      if (CYTHON_TRACE && tstate->c_tracefunc)
          tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
      if (tstate->c_profilefunc)
          tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
      CYTHON_FRAME_DEL(frame);
      tstate->use_tracing = 1;
      tstate->tracing--;
      __Pyx_ErrRestoreInState(tstate, type, value, traceback);
  }
  #ifdef WITH_THREAD
  #define __Pyx_TraceReturn(result, nogil)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (tstate->use_tracing) {\
                  __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
              }\
              PyGILState_Release(state);\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (tstate->use_tracing) {\
              __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
          }\
      }\
  }
  #else
  #define __Pyx_TraceReturn(result, nogil)\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (tstate->use_tracing) {\
          __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
      }\
  }
  #endif
  static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
  static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
#else
  #define __Pyx_TraceDeclarations
  #define __Pyx_TraceFrameInit(codeobj)
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)   if ((1)); else goto_error;
  #define __Pyx_TraceException()
  #define __Pyx_TraceReturn(result, nogil)
#endif
#if CYTHON_TRACE
  static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
      int ret;
      PyObject *type, *value, *traceback;
      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
      __Pyx_PyFrame_SetLineNumber(frame, lineno);
      tstate->tracing++;
      tstate->use_tracing = 0;
      ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
      tstate->use_tracing = 1;
      tstate->tracing--;
      if (likely(!ret)) {
          __Pyx_ErrRestoreInState(tstate, type, value, traceback);
      } else {
          Py_XDECREF(type);
          Py_XDECREF(value);
          Py_XDECREF(traceback);
      }
      return ret;
  }
  #ifdef WITH_THREAD
  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              int ret = 0;\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
                  ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
              }\
              PyGILState_Release(state);\
              if (unlikely(ret)) goto_error;\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
              int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
              if (unlikely(ret)) goto_error;\
          }\
      }\
  }
  #else
  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
          int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
          if (unlikely(ret)) goto_error;\
      }\
  }
  #endif
#else
  #define __Pyx_TraceLine(lineno, nogil, goto_error)   if ((1)); else goto_error;
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddCObj(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* PyNumberPow2.proto */
#define __Pyx_PyNumber_InPlacePowerOf2(a, b, c) __Pyx__PyNumber_PowerOf2(a, b, c, 1)
#define __Pyx_PyNumber_PowerOf2(a, b, c) __Pyx__PyNumber_PowerOf2(a, b, c, 0)
static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject *none, int inplace);

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* tp_new.proto */
#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL)
static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) {
    return (PyObject*) (((PyTypeObject*)type_obj)->tp_new((PyTypeObject*)type_obj, args, kwargs));
}

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* None.proto */
#include <new>

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *__pyx_v_self, int __pyx_v_flag); /* proto*/
static CYTHON_INLINE struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_f_4sage_5rings_9real_mpfr_15RealField_class__new(struct __pyx_obj_4sage_5rings_9real_mpfr_RealField_class *__pyx_v_self); /* proto*/
static CYTHON_INLINE struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_f_4sage_5rings_9real_mpfr_10RealNumber__new(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_v_self); /* proto*/

/* Module declarations from 'sage.structure.sage_object' */
static PyTypeObject *__pyx_ptype_4sage_9structure_11sage_object_SageObject = 0;

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'sage.libs.gmp.types' */

/* Module declarations from 'sage.libs.mpfr.types' */

/* Module declarations from 'sage.libs.mpc.types' */

/* Module declarations from 'sage.structure.category_object' */
static PyTypeObject *__pyx_ptype_4sage_9structure_15category_object_CategoryObject = 0;

/* Module declarations from 'sage.cpython.cython_metaclass' */

/* Module declarations from 'sage.cpython' */

/* Module declarations from 'cython' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'sage.structure.coerce_dict' */
static PyTypeObject *__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict = 0;

/* Module declarations from 'sage.misc.inherit_comparison' */
static PyTypeObject *__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass = 0;

/* Module declarations from 'sage.structure' */

/* Module declarations from 'sage.structure.parent_old' */
static PyTypeObject *__pyx_ptype_4sage_9structure_10parent_old_Parent = 0;

/* Module declarations from 'sage.structure.parent_base' */
static PyTypeObject *__pyx_ptype_4sage_9structure_11parent_base_ParentWithBase = 0;

/* Module declarations from 'sage.structure.parent_gens' */
static PyTypeObject *__pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens = 0;

/* Module declarations from 'sage.rings.ring' */
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Ring = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_CommutativeRing = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_IntegralDomain = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_DedekindDomain = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_EuclideanDomain = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Field = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Algebra = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra = 0;

/* Module declarations from 'sage.rings' */

/* Module declarations from 'sage' */

/* Module declarations from 'sage.structure.parent' */
static PyTypeObject *__pyx_ptype_4sage_9structure_6parent_Parent = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_6parent_Set_generic = 0;

/* Module declarations from 'sage.structure.element' */
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Element = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ModuleElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_RingElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ModuleElementWithMutability = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_MonoidElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CommutativeRingElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_IntegralDomainElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_DedekindDomainElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_FieldElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_AlgebraElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_InfinityElement = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Vector = 0;
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Matrix = 0;
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent(PyObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_classify_elements(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(int); /*proto*/
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_have_same_parent(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/

/* Module declarations from 'sage.rings.complex_mpc' */
static PyTypeObject *__pyx_ptype_4sage_5rings_11complex_mpc_MPComplexNumber = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_11complex_mpc_MPComplexField_class = 0;

/* Module declarations from 'cypari2.types' */

/* Module declarations from 'sage.rings.real_mpfr' */
static PyTypeObject *__pyx_ptype_4sage_5rings_9real_mpfr_RealNumber = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_9real_mpfr_RealField_class = 0;

/* Module declarations from 'hilbert_modgroup.upper_half_plane' */
static PyTypeObject *__pyx_ptype_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class = 0;
static PyTypeObject *__pyx_ptype_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class = 0;

/* Module declarations from 'libc.stdint' */

/* Module declarations from 'sage.libs.gmp.mpz' */

/* Module declarations from 'sage.categories.map' */
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_Map = 0;
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_Section = 0;
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_FormalCompositeMap = 0;

/* Module declarations from 'sage.categories.morphism' */
static PyTypeObject *__pyx_ptype_4sage_10categories_8morphism_Morphism = 0;
static PyTypeObject *__pyx_ptype_4sage_10categories_8morphism_SetMorphism = 0;

/* Module declarations from 'sage.rings.integer' */
static PyTypeObject *__pyx_ptype_4sage_5rings_7integer_Integer = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_7integer_int_to_Z = 0;

/* Module declarations from 'sage.misc.binary_tree' */
static PyTypeObject *__pyx_ptype_4sage_4misc_11binary_tree_BinaryTree = 0;

/* Module declarations from 'sage.rings.polynomial.polynomial_compiled' */
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd = 0;

/* Module declarations from 'sage.rings.polynomial.polynomial_element' */
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact = 0;

/* Module declarations from 'sage.libs.ntl.types' */

/* Module declarations from 'sage.libs.ntl.ntl_ZZX' */
static PyTypeObject *__pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX = 0;

/* Module declarations from 'sage.libs.ntl.ntl_ZZ' */
static PyTypeObject *__pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ = 0;

/* Module declarations from 'sage.rings.number_field.number_field_element' */
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute = 0;
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative = 0;

/* Module declarations from 'hilbert_modgroup.pullback_cython' */
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box(PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_coordinates_to_ideal_elements(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_find_candidate_cusps(PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_candidate_cusps *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_find_closest_cusp(PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_closest_cusp *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_distance_to_cusp(struct __pyx_obj_4sage_9structure_11sage_object_SageObject *, struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *, int __pyx_skip_dispatch); /*proto*/
#define __Pyx_MODULE_NAME "hilbert_modgroup.pullback_cython"
extern int __pyx_module_is_main_hilbert_modgroup__pullback_cython;
int __pyx_module_is_main_hilbert_modgroup__pullback_cython = 0;

/* Implementation of 'hilbert_modgroup.pullback_cython' */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_enumerate;
static const char __pyx_k_p[] = "p";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_s[] = "s";
static const char __pyx_k_z[] = "z";
static const char __pyx_k_gcd[] = "gcd";
static const char __pyx_k_ceil[] = "ceil";
static const char __pyx_k_left[] = "left";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_norm[] = "norm";
static const char __pyx_k_prec[] = "prec";
static const char __pyx_k_sqrt[] = "sqrt";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_cusps[] = "cusps";
static const char __pyx_k_floor[] = "floor";
static const char __pyx_k_group[] = "group";
static const char __pyx_k_ideal[] = "ideal";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_right[] = "right";
static const char __pyx_k_Matrix[] = "Matrix";
static const char __pyx_k_NFCusp[] = "NFCusp";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_ncusps[] = "ncusps";
static const char __pyx_k_parent[] = "parent";
static const char __pyx_k_remove[] = "remove";
static const char __pyx_k_use_lll[] = "use_lll";
static const char __pyx_k_Infinity[] = "Infinity";
static const char __pyx_k_sage_all[] = "sage.all";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_numerator[] = "numerator";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_norm_bound[] = "norm_bound";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_coordinates[] = "coordinates";
static const char __pyx_k_denominator[] = "denominator";
static const char __pyx_k_ideal_basis[] = "ideal_basis";
static const char __pyx_k_initial_bd_d[] = "initial_bd_d";
static const char __pyx_k_number_field[] = "number_field";
static const char __pyx_k_lattice_basis[] = "lattice_basis";
static const char __pyx_k_integral_basis[] = "integral_basis";
static const char __pyx_k_lattice_bounds[] = "lattice_bounds";
static const char __pyx_k_use_norm_bound[] = "use_norm_bound";
static const char __pyx_k_construct_ideal[] = "_construct_ideal";
static const char __pyx_k_identity_matrix[] = "identity_matrix";
static const char __pyx_k_return_multiple[] = "return_multiple";
static const char __pyx_k_sage_arith_misc[] = "sage.arith.misc";
static const char __pyx_k_sage_matrix_all[] = "sage.matrix.all";
static const char __pyx_k_use_initial_bd_d[] = "use_initial_bd_d";
static const char __pyx_k_cartesian_product[] = "cartesian_product";
static const char __pyx_k_coordinate_bounds[] = "coordinate_bounds";
static const char __pyx_k_basis_matrix_ideal[] = "basis_matrix_ideal";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_complex_embeddings[] = "complex_embeddings";
static const char __pyx_k_sage_rings_infinity[] = "sage.rings.infinity";
static const char __pyx_k_bound_for_sigma_norm[] = "_bound_for_sigma_norm";
static const char __pyx_k_is_NumberFieldElement[] = "is_NumberFieldElement";
static const char __pyx_k_sage_modular_cusps_nf[] = "sage.modular.cusps_nf";
static const char __pyx_k_bound_for_closest_cusp[] = "_bound_for_closest_cusp";
static const char __pyx_k_return_sigma_candidates[] = "return_sigma_candidates";
static const char __pyx_k_sage_matrix_constructor[] = "sage.matrix.constructor";
static const char __pyx_k_bound_for_rho_embeddings[] = "_bound_for_rho_embeddings";
static const char __pyx_k_bound_for_rho_coordinates[] = "_bound_for_rho_coordinates";
static const char __pyx_k_bound_for_sigma_embeddings[] = "_bound_for_sigma_embeddings";
static const char __pyx_k_get_heuristic_closest_cusp[] = "get_heuristic_closest_cusp";
static const char __pyx_k_bound_for_sigma_coordinates[] = "_bound_for_sigma_coordinates";
static const char __pyx_k_Cython_versions_of_Pullback_alg[] = "\nCython versions of Pullback algorithms.\n\nNote: These are the algorithms that needs optimizing to make it all faster.\n";
static const char __pyx_k_Bounds_must_give_interval_of_pos[] = "Bounds must give interval of positive length.";
static const char __pyx_k_Coordinate_need_to_have_same_len[] = "Coordinate need to have same length as basis!";
static const char __pyx_k_sage_rings_number_field_number_f[] = "sage.rings.number_field.number_field_element";
static PyObject *__pyx_kp_u_Bounds_must_give_interval_of_pos;
static PyObject *__pyx_kp_u_Coordinate_need_to_have_same_len;
static PyObject *__pyx_n_s_Infinity;
static PyObject *__pyx_n_s_Matrix;
static PyObject *__pyx_n_s_NFCusp;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_basis_matrix_ideal;
static PyObject *__pyx_n_s_bound_for_closest_cusp;
static PyObject *__pyx_n_s_bound_for_rho_coordinates;
static PyObject *__pyx_n_s_bound_for_rho_embeddings;
static PyObject *__pyx_n_s_bound_for_sigma_coordinates;
static PyObject *__pyx_n_s_bound_for_sigma_embeddings;
static PyObject *__pyx_n_s_bound_for_sigma_norm;
static PyObject *__pyx_n_s_cartesian_product;
static PyObject *__pyx_n_s_ceil;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_complex_embeddings;
static PyObject *__pyx_n_s_construct_ideal;
static PyObject *__pyx_n_s_coordinate_bounds;
static PyObject *__pyx_n_s_coordinates;
static PyObject *__pyx_n_s_cusps;
static PyObject *__pyx_n_s_denominator;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_floor;
static PyObject *__pyx_n_s_gcd;
static PyObject *__pyx_n_s_get_heuristic_closest_cusp;
static PyObject *__pyx_n_s_group;
static PyObject *__pyx_n_s_ideal;
static PyObject *__pyx_n_s_ideal_basis;
static PyObject *__pyx_n_s_identity_matrix;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_initial_bd_d;
static PyObject *__pyx_n_s_integral_basis;
static PyObject *__pyx_n_s_is_NumberFieldElement;
static PyObject *__pyx_n_s_lattice_basis;
static PyObject *__pyx_n_s_lattice_bounds;
static PyObject *__pyx_n_s_left;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_ncusps;
static PyObject *__pyx_n_s_norm;
static PyObject *__pyx_n_s_norm_bound;
static PyObject *__pyx_n_s_number_field;
static PyObject *__pyx_n_s_numerator;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_parent;
static PyObject *__pyx_n_s_prec;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_return_multiple;
static PyObject *__pyx_n_s_return_sigma_candidates;
static PyObject *__pyx_n_s_right;
static PyObject *__pyx_n_s_s;
static PyObject *__pyx_n_s_sage_all;
static PyObject *__pyx_n_s_sage_arith_misc;
static PyObject *__pyx_n_s_sage_matrix_all;
static PyObject *__pyx_n_s_sage_matrix_constructor;
static PyObject *__pyx_n_s_sage_modular_cusps_nf;
static PyObject *__pyx_n_s_sage_rings_infinity;
static PyObject *__pyx_n_s_sage_rings_number_field_number_f;
static PyObject *__pyx_n_s_sqrt;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_use_initial_bd_d;
static PyObject *__pyx_n_s_use_lll;
static PyObject *__pyx_n_s_use_norm_bound;
static PyObject *__pyx_n_s_z;
static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bounds); /* proto */
static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_2lattice_elements_in_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice_basis, PyObject *__pyx_v_lattice_bounds, PyObject *__pyx_v_coordinate_bounds, PyObject *__pyx_v_norm_bound); /* proto */
static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_4coordinates_to_ideal_elements(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_coordinates, PyObject *__pyx_v_ideal_basis); /* proto */
static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_6find_candidate_cusps(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_z, PyObject *__pyx_v_use_lll, PyObject *__pyx_v_use_norm_bound, PyObject *__pyx_v_return_sigma_candidates, PyObject *__pyx_v_initial_bd_d, PyObject *__pyx_v_use_initial_bd_d); /* proto */
static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_8find_closest_cusp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_z, PyObject *__pyx_v_return_multiple, PyObject *__pyx_v_use_lll, PyObject *__pyx_v_use_norm_bound); /* proto */
static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_10distance_to_cusp(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4sage_9structure_11sage_object_SageObject *__pyx_v_p, struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_v_r, struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_v_s, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_4sage_9structure_7element_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_4sage_9structure_7element_2have_same_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_remove = {0, &__pyx_n_s_remove, 0, 0, 0};
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_slice__3;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__4;
/* Late includes */

/* "hilbert_modgroup/pullback_cython.pyx":19
 * from sage.matrix.all import Matrix
 * 
 * cpdef integral_coordinates_in_box(bounds):             # <<<<<<<<<<<<<<
 *     """
 *     Find all integral points inside a box in R^n.
 */

static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_1integral_coordinates_in_box(PyObject *__pyx_self, PyObject *__pyx_v_bounds); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box(PyObject *__pyx_v_bounds, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_v_coordinates = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_lower = NULL;
  PyObject *__pyx_v_upper = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("integral_coordinates_in_box", 0);
  __Pyx_TraceCall("integral_coordinates_in_box", __pyx_f[0], 19, 0, __PYX_ERR(0, 19, __pyx_L1_error));

  /* "hilbert_modgroup/pullback_cython.pyx":54
 *          (1, 1, 0)]
 *     """
 *     if not isinstance(bounds, list):             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     n = len(bounds)
 */
  __pyx_t_1 = PyList_Check(__pyx_v_bounds); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "hilbert_modgroup/pullback_cython.pyx":55
 *     """
 *     if not isinstance(bounds, list):
 *         raise ValueError             # <<<<<<<<<<<<<<
 *     n = len(bounds)
 *     coordinates = []
 */
    __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
    __PYX_ERR(0, 55, __pyx_L1_error)

    /* "hilbert_modgroup/pullback_cython.pyx":54
 *          (1, 1, 0)]
 *     """
 *     if not isinstance(bounds, list):             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     n = len(bounds)
 */
  }

  /* "hilbert_modgroup/pullback_cython.pyx":56
 *     if not isinstance(bounds, list):
 *         raise ValueError
 *     n = len(bounds)             # <<<<<<<<<<<<<<
 *     coordinates = []
 *     for i in range(n):
 */
  __pyx_t_3 = PyObject_Length(__pyx_v_bounds); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 56, __pyx_L1_error)
  __pyx_v_n = __pyx_t_3;

  /* "hilbert_modgroup/pullback_cython.pyx":57
 *         raise ValueError
 *     n = len(bounds)
 *     coordinates = []             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         lower = ceil(bounds[i][0])
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_coordinates = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":58
 *     n = len(bounds)
 *     coordinates = []
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         lower = ceil(bounds[i][0])
 *         upper = floor(bounds[i][1])
 */
  __pyx_t_3 = __pyx_v_n;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "hilbert_modgroup/pullback_cython.pyx":59
 *     coordinates = []
 *     for i in range(n):
 *         lower = ceil(bounds[i][0])             # <<<<<<<<<<<<<<
 *         upper = floor(bounds[i][1])
 *         if lower > upper:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_ceil); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_bounds, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_lower, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":60
 *     for i in range(n):
 *         lower = ceil(bounds[i][0])
 *         upper = floor(bounds[i][1])             # <<<<<<<<<<<<<<
 *         if lower > upper:
 *             raise ValueError("Bounds must give interval of positive length.")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_floor); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_bounds, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_upper, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":61
 *         lower = ceil(bounds[i][0])
 *         upper = floor(bounds[i][1])
 *         if lower > upper:             # <<<<<<<<<<<<<<
 *             raise ValueError("Bounds must give interval of positive length.")
 *         coordinates.append(range(lower, upper + 1))
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_lower, __pyx_v_upper, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_t_2)) {

      /* "hilbert_modgroup/pullback_cython.pyx":62
 *         upper = floor(bounds[i][1])
 *         if lower > upper:
 *             raise ValueError("Bounds must give interval of positive length.")             # <<<<<<<<<<<<<<
 *         coordinates.append(range(lower, upper + 1))
 *     # result = [tuple(x) for x in cartesian_product(coordinates)]
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __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, 62, __pyx_L1_error)

      /* "hilbert_modgroup/pullback_cython.pyx":61
 *         lower = ceil(bounds[i][0])
 *         upper = floor(bounds[i][1])
 *         if lower > upper:             # <<<<<<<<<<<<<<
 *             raise ValueError("Bounds must give interval of positive length.")
 *         coordinates.append(range(lower, upper + 1))
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":63
 *         if lower > upper:
 *             raise ValueError("Bounds must give interval of positive length.")
 *         coordinates.append(range(lower, upper + 1))             # <<<<<<<<<<<<<<
 *     # result = [tuple(x) for x in cartesian_product(coordinates)]
 *     # return result
 */
    __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_upper, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_lower);
    __Pyx_GIVEREF(__pyx_v_lower);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lower);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_coordinates, __pyx_t_4); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }

  /* "hilbert_modgroup/pullback_cython.pyx":66
 *     # result = [tuple(x) for x in cartesian_product(coordinates)]
 *     # return result
 *     return list(cartesian_product(coordinates))             # <<<<<<<<<<<<<<
 * 
 * cpdef lattice_elements_in_box(lattice_basis, lattice_bounds, coordinate_bounds, norm_bound=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_cartesian_product); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_coordinates) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_coordinates);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "hilbert_modgroup/pullback_cython.pyx":19
 * from sage.matrix.all import Matrix
 * 
 * cpdef integral_coordinates_in_box(bounds):             # <<<<<<<<<<<<<<
 *     """
 *     Find all integral points inside a box in R^n.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.integral_coordinates_in_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_coordinates);
  __Pyx_XDECREF(__pyx_v_lower);
  __Pyx_XDECREF(__pyx_v_upper);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_1integral_coordinates_in_box(PyObject *__pyx_self, PyObject *__pyx_v_bounds); /*proto*/
static char __pyx_doc_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box[] = "integral_coordinates_in_box(bounds)\n\n    Find all integral points inside a box in R^n.\n\n    INPUT:\n    - `bounds` -- a list of upper and lower bounds defining a parallelepiped of positive volume.\n\n    EXAMPLES::\n    \n        sage: from hilbert_modgroup.pullback_cython import integral_coordinates_in_box\n        sage: integral_coordinates_in_box([(-1,1),(-1,1)])\n        [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 0), (0, 1), (1, -1), (1, 0), (1, 1)]        \n        sage: integral_coordinates_in_box([(-1,1),(-1.5,1.5)])\n        [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 0), (0, 1), (1, -1), (1, 0), (1, 1)]        \n        sage: integral_coordinates_in_box([(-1,1),(-1,1),(-0.5,0.5)])\n        [(-1, -1, 0),\n         (-1, 0, 0),\n         (-1, 1, 0),\n         (0, -1, 0),\n         (0, 0, 0),\n         (0, 1, 0),\n         (1, -1, 0),\n         (1, 0, 0),\n         (1, 1, 0)]\n        sage: integral_coordinates_in_box([(-1,1),(-1,1),(-0.5,0.5)])\n        [(-1, -1, 0),\n         (-1, 0, 0),\n         (-1, 1, 0),\n         (0, -1, 0),\n         (0, 0, 0),\n         (0, 1, 0),\n         (1, -1, 0),\n         (1, 0, 0),\n         (1, 1, 0)]\n    ";
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_1integral_coordinates_in_box(PyObject *__pyx_self, PyObject *__pyx_v_bounds) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("integral_coordinates_in_box (wrapper)", 0);
  __pyx_r = __pyx_pf_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box(__pyx_self, ((PyObject *)__pyx_v_bounds));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bounds) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("integral_coordinates_in_box", 0);
  __Pyx_TraceCall("integral_coordinates_in_box (wrapper)", __pyx_f[0], 19, 0, __PYX_ERR(0, 19, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box(__pyx_v_bounds, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __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("hilbert_modgroup.pullback_cython.integral_coordinates_in_box", __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;
}

/* "hilbert_modgroup/pullback_cython.pyx":68
 *     return list(cartesian_product(coordinates))
 * 
 * cpdef lattice_elements_in_box(lattice_basis, lattice_bounds, coordinate_bounds, norm_bound=None):             # <<<<<<<<<<<<<<
 *     """
 *     Return all coordinates of elements in a lattice in R^n restricted to a specific box and with
 */

static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_3lattice_elements_in_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box(PyObject *__pyx_v_lattice_basis, PyObject *__pyx_v_lattice_bounds, PyObject *__pyx_v_coordinate_bounds, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box *__pyx_optional_args) {
  PyObject *__pyx_v_norm_bound = ((PyObject *)Py_None);
  PyObject *__pyx_v_coordinates = NULL;
  PyObject *__pyx_v_result = NULL;
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_v_coordinate_vector = NULL;
  int __pyx_v_is_within_bounds;
  PyObject *__pyx_v_norm = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_alpha_i = NULL;
  Py_ssize_t __pyx_v_j;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lattice_elements_in_box", 0);
  __Pyx_TraceCall("lattice_elements_in_box", __pyx_f[0], 68, 0, __PYX_ERR(0, 68, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_norm_bound = __pyx_optional_args->norm_bound;
    }
  }

  /* "hilbert_modgroup/pullback_cython.pyx":95
 * 
 *     """
 *     coordinates = integral_coordinates_in_box(coordinate_bounds)             # <<<<<<<<<<<<<<
 *     result = []
 *     n = len(lattice_basis[0])
 */
  __pyx_t_1 = __pyx_f_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box(__pyx_v_coordinate_bounds, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_coordinates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":96
 *     """
 *     coordinates = integral_coordinates_in_box(coordinate_bounds)
 *     result = []             # <<<<<<<<<<<<<<
 *     n = len(lattice_basis[0])
 *     for coordinate_vector in coordinates:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":97
 *     coordinates = integral_coordinates_in_box(coordinate_bounds)
 *     result = []
 *     n = len(lattice_basis[0])             # <<<<<<<<<<<<<<
 *     for coordinate_vector in coordinates:
 *         is_within_bounds = True
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_lattice_basis, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_n = __pyx_t_2;

  /* "hilbert_modgroup/pullback_cython.pyx":98
 *     result = []
 *     n = len(lattice_basis[0])
 *     for coordinate_vector in coordinates:             # <<<<<<<<<<<<<<
 *         is_within_bounds = True
 *         if norm_bound:
 */
  if (likely(PyList_CheckExact(__pyx_v_coordinates)) || PyTuple_CheckExact(__pyx_v_coordinates)) {
    __pyx_t_1 = __pyx_v_coordinates; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_coordinates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 98, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_coordinate_vector, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":99
 *     n = len(lattice_basis[0])
 *     for coordinate_vector in coordinates:
 *         is_within_bounds = True             # <<<<<<<<<<<<<<
 *         if norm_bound:
 *             norm = 1
 */
    __pyx_v_is_within_bounds = 1;

    /* "hilbert_modgroup/pullback_cython.pyx":100
 *     for coordinate_vector in coordinates:
 *         is_within_bounds = True
 *         if norm_bound:             # <<<<<<<<<<<<<<
 *             norm = 1
 *         for i in range(n):
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_norm_bound); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 100, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "hilbert_modgroup/pullback_cython.pyx":101
 *         is_within_bounds = True
 *         if norm_bound:
 *             norm = 1             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             alpha_i = 0.0
 */
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_XDECREF_SET(__pyx_v_norm, __pyx_int_1);

      /* "hilbert_modgroup/pullback_cython.pyx":100
 *     for coordinate_vector in coordinates:
 *         is_within_bounds = True
 *         if norm_bound:             # <<<<<<<<<<<<<<
 *             norm = 1
 *         for i in range(n):
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":102
 *         if norm_bound:
 *             norm = 1
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             alpha_i = 0.0
 *             for j in range(n):
 */
    __pyx_t_6 = __pyx_v_n;
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "hilbert_modgroup/pullback_cython.pyx":103
 *             norm = 1
 *         for i in range(n):
 *             alpha_i = 0.0             # <<<<<<<<<<<<<<
 *             for j in range(n):
 *                 alpha_i = alpha_i + lattice_basis[i][j] * coordinate_vector[j]
 */
      __Pyx_INCREF(__pyx_float_0_0);
      __Pyx_XDECREF_SET(__pyx_v_alpha_i, __pyx_float_0_0);

      /* "hilbert_modgroup/pullback_cython.pyx":104
 *         for i in range(n):
 *             alpha_i = 0.0
 *             for j in range(n):             # <<<<<<<<<<<<<<
 *                 alpha_i = alpha_i + lattice_basis[i][j] * coordinate_vector[j]
 *             if alpha_i < lattice_bounds[i][0] or alpha_i > lattice_bounds[i][1]:
 */
      __pyx_t_9 = __pyx_v_n;
      __pyx_t_10 = __pyx_t_9;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
        __pyx_v_j = __pyx_t_11;

        /* "hilbert_modgroup/pullback_cython.pyx":105
 *             alpha_i = 0.0
 *             for j in range(n):
 *                 alpha_i = alpha_i + lattice_basis[i][j] * coordinate_vector[j]             # <<<<<<<<<<<<<<
 *             if alpha_i < lattice_bounds[i][0] or alpha_i > lattice_bounds[i][1]:
 *                 # We need to discard this
 */
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_lattice_basis, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_j, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_coordinate_vector, __pyx_v_j, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_13 = PyNumber_Multiply(__pyx_t_12, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Add(__pyx_v_alpha_i, __pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF_SET(__pyx_v_alpha_i, __pyx_t_4);
        __pyx_t_4 = 0;
      }

      /* "hilbert_modgroup/pullback_cython.pyx":106
 *             for j in range(n):
 *                 alpha_i = alpha_i + lattice_basis[i][j] * coordinate_vector[j]
 *             if alpha_i < lattice_bounds[i][0] or alpha_i > lattice_bounds[i][1]:             # <<<<<<<<<<<<<<
 *                 # We need to discard this
 *                 is_within_bounds = False
 */
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_lattice_bounds, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_alpha_i, __pyx_t_13, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_14) {
      } else {
        __pyx_t_5 = __pyx_t_14;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_lattice_bounds, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_alpha_i, __pyx_t_13, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __pyx_t_14;
      __pyx_L11_bool_binop_done:;
      if (__pyx_t_5) {

        /* "hilbert_modgroup/pullback_cython.pyx":108
 *             if alpha_i < lattice_bounds[i][0] or alpha_i > lattice_bounds[i][1]:
 *                 # We need to discard this
 *                 is_within_bounds = False             # <<<<<<<<<<<<<<
 *                 break
 *             if norm_bound:
 */
        __pyx_v_is_within_bounds = 0;

        /* "hilbert_modgroup/pullback_cython.pyx":109
 *                 # We need to discard this
 *                 is_within_bounds = False
 *                 break             # <<<<<<<<<<<<<<
 *             if norm_bound:
 *                 norm = norm*alpha_i
 */
        goto __pyx_L7_break;

        /* "hilbert_modgroup/pullback_cython.pyx":106
 *             for j in range(n):
 *                 alpha_i = alpha_i + lattice_basis[i][j] * coordinate_vector[j]
 *             if alpha_i < lattice_bounds[i][0] or alpha_i > lattice_bounds[i][1]:             # <<<<<<<<<<<<<<
 *                 # We need to discard this
 *                 is_within_bounds = False
 */
      }

      /* "hilbert_modgroup/pullback_cython.pyx":110
 *                 is_within_bounds = False
 *                 break
 *             if norm_bound:             # <<<<<<<<<<<<<<
 *                 norm = norm*alpha_i
 *         if norm_bound and abs(norm) > norm_bound:
 */
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_norm_bound); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "hilbert_modgroup/pullback_cython.pyx":111
 *                 break
 *             if norm_bound:
 *                 norm = norm*alpha_i             # <<<<<<<<<<<<<<
 *         if norm_bound and abs(norm) > norm_bound:
 *             is_within_bounds = False
 */
        if (unlikely(!__pyx_v_norm)) { __Pyx_RaiseUnboundLocalError("norm"); __PYX_ERR(0, 111, __pyx_L1_error) }
        __pyx_t_4 = PyNumber_Multiply(__pyx_v_norm, __pyx_v_alpha_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_norm, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "hilbert_modgroup/pullback_cython.pyx":110
 *                 is_within_bounds = False
 *                 break
 *             if norm_bound:             # <<<<<<<<<<<<<<
 *                 norm = norm*alpha_i
 *         if norm_bound and abs(norm) > norm_bound:
 */
      }
    }
    __pyx_L7_break:;

    /* "hilbert_modgroup/pullback_cython.pyx":112
 *             if norm_bound:
 *                 norm = norm*alpha_i
 *         if norm_bound and abs(norm) > norm_bound:             # <<<<<<<<<<<<<<
 *             is_within_bounds = False
 *         # If we are within the bounds we add the number field element.
 */
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_norm_bound); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
    if (__pyx_t_14) {
    } else {
      __pyx_t_5 = __pyx_t_14;
      goto __pyx_L15_bool_binop_done;
    }
    if (unlikely(!__pyx_v_norm)) { __Pyx_RaiseUnboundLocalError("norm"); __PYX_ERR(0, 112, __pyx_L1_error) }
    __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_v_norm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_13 = PyObject_RichCompare(__pyx_t_4, __pyx_v_norm_bound, Py_GT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_5 = __pyx_t_14;
    __pyx_L15_bool_binop_done:;
    if (__pyx_t_5) {

      /* "hilbert_modgroup/pullback_cython.pyx":113
 *                 norm = norm*alpha_i
 *         if norm_bound and abs(norm) > norm_bound:
 *             is_within_bounds = False             # <<<<<<<<<<<<<<
 *         # If we are within the bounds we add the number field element.
 *         if is_within_bounds:
 */
      __pyx_v_is_within_bounds = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":112
 *             if norm_bound:
 *                 norm = norm*alpha_i
 *         if norm_bound and abs(norm) > norm_bound:             # <<<<<<<<<<<<<<
 *             is_within_bounds = False
 *         # If we are within the bounds we add the number field element.
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":115
 *             is_within_bounds = False
 *         # If we are within the bounds we add the number field element.
 *         if is_within_bounds:             # <<<<<<<<<<<<<<
 *             result.append(coordinate_vector)
 *     return result
 */
    __pyx_t_5 = (__pyx_v_is_within_bounds != 0);
    if (__pyx_t_5) {

      /* "hilbert_modgroup/pullback_cython.pyx":116
 *         # If we are within the bounds we add the number field element.
 *         if is_within_bounds:
 *             result.append(coordinate_vector)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
      __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_coordinate_vector); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 116, __pyx_L1_error)

      /* "hilbert_modgroup/pullback_cython.pyx":115
 *             is_within_bounds = False
 *         # If we are within the bounds we add the number field element.
 *         if is_within_bounds:             # <<<<<<<<<<<<<<
 *             result.append(coordinate_vector)
 *     return result
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":98
 *     result = []
 *     n = len(lattice_basis[0])
 *     for coordinate_vector in coordinates:             # <<<<<<<<<<<<<<
 *         is_within_bounds = True
 *         if norm_bound:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":117
 *         if is_within_bounds:
 *             result.append(coordinate_vector)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cpdef coordinates_to_ideal_elements(coordinates,ideal_basis):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "hilbert_modgroup/pullback_cython.pyx":68
 *     return list(cartesian_product(coordinates))
 * 
 * cpdef lattice_elements_in_box(lattice_basis, lattice_bounds, coordinate_bounds, norm_bound=None):             # <<<<<<<<<<<<<<
 *     """
 *     Return all coordinates of elements in a lattice in R^n restricted to a specific box and with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.lattice_elements_in_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_coordinates);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_coordinate_vector);
  __Pyx_XDECREF(__pyx_v_norm);
  __Pyx_XDECREF(__pyx_v_alpha_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_3lattice_elements_in_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_16hilbert_modgroup_15pullback_cython_2lattice_elements_in_box[] = "lattice_elements_in_box(lattice_basis, lattice_bounds, coordinate_bounds, norm_bound=None)\n\n    Return all coordinates of elements in a lattice in R^n restricted to a specific box and with\n    coordinates in another box.\n\n    INPUT:\n    - ``lattice_basis`` -- a list of lists of a basis of the embedded lattice\n    - ``lattice_bounds`` -- the bounds for the embeddings\n    - ``coordinate_bounds`` -- the bounds for the coordinates\n    - ``norm_bound`` -- bounds for the norm (default None - meaning that no bounds are applied)\n    \n    EXAMPLES::\n    \n        sage: from hilbert_modgroup.pullback_cython import lattice_elements_in_box\n        sage: lattice_elements_in_box([[0,1],[1,0]],[(-1,1),(-1,1)],[(-1,1),(-1,1)])\n        [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 0), (0, 1), (1, -1), (1, 0), (1, 1)]\n        sage: lattice_elements_in_box([[2,0],[0,2]],[(-2,2),(-1,1)],[(-1,1),(-1,1)])\n        [(-1, 0), (0, 0), (1, 0)]\n        sage: from hilbert_modgroup.all import *\n        sage: P1 = HilbertPullback(HilbertModularGroup(5))\n        sage: lb, ib = P1._get_lattice_and_ideal_basis()\n        sage: lattice_elements_in_box(lb,[(-2,2),(-2,2)],[(-1,1),(-1,1)])\n        [(-1, -1), (-1, 0), (0, -1), (0, 0), (0, 1), (1, 0), (1, 1)]\n        sage: lattice_elements_in_box(lb,[(-2,2),(-2,2)],[(-1,1),(0,1)])\n        [(-1, 0), (0, 0), (0, 1), (1, 0), (1, 1)]\n        \n    ";
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_3lattice_elements_in_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lattice_basis = 0;
  PyObject *__pyx_v_lattice_bounds = 0;
  PyObject *__pyx_v_coordinate_bounds = 0;
  PyObject *__pyx_v_norm_bound = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lattice_elements_in_box (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lattice_basis,&__pyx_n_s_lattice_bounds,&__pyx_n_s_coordinate_bounds,&__pyx_n_s_norm_bound,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lattice_basis)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lattice_bounds)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lattice_elements_in_box", 0, 3, 4, 1); __PYX_ERR(0, 68, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coordinate_bounds)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lattice_elements_in_box", 0, 3, 4, 2); __PYX_ERR(0, 68, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_norm_bound);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lattice_elements_in_box") < 0)) __PYX_ERR(0, 68, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lattice_basis = values[0];
    __pyx_v_lattice_bounds = values[1];
    __pyx_v_coordinate_bounds = values[2];
    __pyx_v_norm_bound = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lattice_elements_in_box", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 68, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.lattice_elements_in_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_16hilbert_modgroup_15pullback_cython_2lattice_elements_in_box(__pyx_self, __pyx_v_lattice_basis, __pyx_v_lattice_bounds, __pyx_v_coordinate_bounds, __pyx_v_norm_bound);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_2lattice_elements_in_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice_basis, PyObject *__pyx_v_lattice_bounds, PyObject *__pyx_v_coordinate_bounds, PyObject *__pyx_v_norm_bound) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lattice_elements_in_box", 0);
  __Pyx_TraceCall("lattice_elements_in_box (wrapper)", __pyx_f[0], 68, 0, __PYX_ERR(0, 68, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.norm_bound = __pyx_v_norm_bound;
  __pyx_t_1 = __pyx_f_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box(__pyx_v_lattice_basis, __pyx_v_lattice_bounds, __pyx_v_coordinate_bounds, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __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("hilbert_modgroup.pullback_cython.lattice_elements_in_box", __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;
}

/* "hilbert_modgroup/pullback_cython.pyx":119
 *     return result
 * 
 * cpdef coordinates_to_ideal_elements(coordinates,ideal_basis):             # <<<<<<<<<<<<<<
 *     r"""
 *     Return elements of an ideal given by coordinates and a basis.
 */

static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_5coordinates_to_ideal_elements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_coordinates_to_ideal_elements(PyObject *__pyx_v_coordinates, PyObject *__pyx_v_ideal_basis, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_result = NULL;
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_v_coordinate_vector = NULL;
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coordinates_to_ideal_elements", 0);
  __Pyx_TraceCall("coordinates_to_ideal_elements", __pyx_f[0], 119, 0, __PYX_ERR(0, 119, __pyx_L1_error));

  /* "hilbert_modgroup/pullback_cython.pyx":144
 * 
 *     """
 *     result = []             # <<<<<<<<<<<<<<
 *     n = len(ideal_basis)
 *     for coordinate_vector in coordinates:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":145
 *     """
 *     result = []
 *     n = len(ideal_basis)             # <<<<<<<<<<<<<<
 *     for coordinate_vector in coordinates:
 *         if len(coordinate_vector) != n:
 */
  __pyx_t_2 = PyObject_Length(__pyx_v_ideal_basis); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 145, __pyx_L1_error)
  __pyx_v_n = __pyx_t_2;

  /* "hilbert_modgroup/pullback_cython.pyx":146
 *     result = []
 *     n = len(ideal_basis)
 *     for coordinate_vector in coordinates:             # <<<<<<<<<<<<<<
 *         if len(coordinate_vector) != n:
 *             raise ValueError("Coordinate need to have same length as basis!")
 */
  if (likely(PyList_CheckExact(__pyx_v_coordinates)) || PyTuple_CheckExact(__pyx_v_coordinates)) {
    __pyx_t_1 = __pyx_v_coordinates; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_coordinates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 146, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 146, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 146, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_coordinate_vector, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":147
 *     n = len(ideal_basis)
 *     for coordinate_vector in coordinates:
 *         if len(coordinate_vector) != n:             # <<<<<<<<<<<<<<
 *             raise ValueError("Coordinate need to have same length as basis!")
 *         element = 0
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_coordinate_vector); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 147, __pyx_L1_error)
    __pyx_t_6 = ((__pyx_t_5 != __pyx_v_n) != 0);
    if (unlikely(__pyx_t_6)) {

      /* "hilbert_modgroup/pullback_cython.pyx":148
 *     for coordinate_vector in coordinates:
 *         if len(coordinate_vector) != n:
 *             raise ValueError("Coordinate need to have same length as basis!")             # <<<<<<<<<<<<<<
 *         element = 0
 *         for i,b in enumerate(ideal_basis):
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __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, 148, __pyx_L1_error)

      /* "hilbert_modgroup/pullback_cython.pyx":147
 *     n = len(ideal_basis)
 *     for coordinate_vector in coordinates:
 *         if len(coordinate_vector) != n:             # <<<<<<<<<<<<<<
 *             raise ValueError("Coordinate need to have same length as basis!")
 *         element = 0
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":149
 *         if len(coordinate_vector) != n:
 *             raise ValueError("Coordinate need to have same length as basis!")
 *         element = 0             # <<<<<<<<<<<<<<
 *         for i,b in enumerate(ideal_basis):
 *             element += b * coordinate_vector[i]
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_XDECREF_SET(__pyx_v_element, __pyx_int_0);

    /* "hilbert_modgroup/pullback_cython.pyx":150
 *             raise ValueError("Coordinate need to have same length as basis!")
 *         element = 0
 *         for i,b in enumerate(ideal_basis):             # <<<<<<<<<<<<<<
 *             element += b * coordinate_vector[i]
 *         result.append(element)
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_4 = __pyx_int_0;
    if (likely(PyList_CheckExact(__pyx_v_ideal_basis)) || PyTuple_CheckExact(__pyx_v_ideal_basis)) {
      __pyx_t_7 = __pyx_v_ideal_basis; __Pyx_INCREF(__pyx_t_7); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_ideal_basis); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        }
      } else {
        __pyx_t_9 = __pyx_t_8(__pyx_t_7);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 150, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
      __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":151
 *         element = 0
 *         for i,b in enumerate(ideal_basis):
 *             element += b * coordinate_vector[i]             # <<<<<<<<<<<<<<
 *         result.append(element)
 *     return result
 */
      __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_coordinate_vector, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyNumber_Multiply(__pyx_v_b, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_element, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_element, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":150
 *             raise ValueError("Coordinate need to have same length as basis!")
 *         element = 0
 *         for i,b in enumerate(ideal_basis):             # <<<<<<<<<<<<<<
 *             element += b * coordinate_vector[i]
 *         result.append(element)
 */
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":152
 *         for i,b in enumerate(ideal_basis):
 *             element += b * coordinate_vector[i]
 *         result.append(element)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_element); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 152, __pyx_L1_error)

    /* "hilbert_modgroup/pullback_cython.pyx":146
 *     result = []
 *     n = len(ideal_basis)
 *     for coordinate_vector in coordinates:             # <<<<<<<<<<<<<<
 *         if len(coordinate_vector) != n:
 *             raise ValueError("Coordinate need to have same length as basis!")
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":153
 *             element += b * coordinate_vector[i]
 *         result.append(element)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "hilbert_modgroup/pullback_cython.pyx":119
 *     return result
 * 
 * cpdef coordinates_to_ideal_elements(coordinates,ideal_basis):             # <<<<<<<<<<<<<<
 *     r"""
 *     Return elements of an ideal given by coordinates and a basis.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.coordinates_to_ideal_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_coordinate_vector);
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_5coordinates_to_ideal_elements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_16hilbert_modgroup_15pullback_cython_4coordinates_to_ideal_elements[] = "coordinates_to_ideal_elements(coordinates, ideal_basis)\n\n    Return elements of an ideal given by coordinates and a basis.\n    \n    INPUT:\n    - `coordinates` -- a list of coordinates (as tuples or lists) of the same length as the basis.\n    - `ideal_basis` -- the basis of an ideal.\n    \n    EXAMPLES::\n    \n        sage: from hilbert_modgroup.pullback_cython import coordinates_to_ideal_elements\n        sage: from hilbert_modgroup.all import *\n        sage: P1 = HilbertPullback(HilbertModularGroup(5))\n        sage: lb, ib = P1._get_lattice_and_ideal_basis()\n        sage: coordinates_to_ideal_elements([[1,1],(2,3)],ib)\n        [1/2*a + 1/2, 3/2*a + 1/2]\n        \n    TESTS::\n        \n        sage: coordinates_to_ideal_elements([[1,1],(2,2,1)],ib)\n        Traceback (most recent call last):\n        ...\n        ValueError: Coordinate need to have same length as basis!\n                        \n    ";
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_5coordinates_to_ideal_elements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_coordinates = 0;
  PyObject *__pyx_v_ideal_basis = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coordinates_to_ideal_elements (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coordinates,&__pyx_n_s_ideal_basis,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coordinates)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ideal_basis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("coordinates_to_ideal_elements", 1, 2, 2, 1); __PYX_ERR(0, 119, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "coordinates_to_ideal_elements") < 0)) __PYX_ERR(0, 119, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_coordinates = values[0];
    __pyx_v_ideal_basis = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("coordinates_to_ideal_elements", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 119, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.coordinates_to_ideal_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_16hilbert_modgroup_15pullback_cython_4coordinates_to_ideal_elements(__pyx_self, __pyx_v_coordinates, __pyx_v_ideal_basis);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_4coordinates_to_ideal_elements(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_coordinates, PyObject *__pyx_v_ideal_basis) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("coordinates_to_ideal_elements", 0);
  __Pyx_TraceCall("coordinates_to_ideal_elements (wrapper)", __pyx_f[0], 119, 0, __PYX_ERR(0, 119, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_16hilbert_modgroup_15pullback_cython_coordinates_to_ideal_elements(__pyx_v_coordinates, __pyx_v_ideal_basis, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __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("hilbert_modgroup.pullback_cython.coordinates_to_ideal_elements", __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;
}

/* "hilbert_modgroup/pullback_cython.pyx":156
 * 
 * 
 * cpdef find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False,             # <<<<<<<<<<<<<<
 *                            initial_bd_d=None,
 *                            use_initial_bd_d=True):
 */

static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_7find_candidate_cusps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_find_candidate_cusps(PyObject *__pyx_v_p, PyObject *__pyx_v_z, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_candidate_cusps *__pyx_optional_args) {
  PyObject *__pyx_v_use_lll = ((PyObject *)Py_True);
  PyObject *__pyx_v_use_norm_bound = ((PyObject *)Py_True);
  PyObject *__pyx_v_return_sigma_candidates = ((PyObject *)Py_False);

  /* "hilbert_modgroup/pullback_cython.pyx":157
 * 
 * cpdef find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False,
 *                            initial_bd_d=None,             # <<<<<<<<<<<<<<
 *                            use_initial_bd_d=True):
 *     r"""
 */
  PyObject *__pyx_v_initial_bd_d = ((PyObject *)Py_None);

  /* "hilbert_modgroup/pullback_cython.pyx":158
 * cpdef find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False,
 *                            initial_bd_d=None,
 *                            use_initial_bd_d=True):             # <<<<<<<<<<<<<<
 *     r"""
 *     Return candidates for closest cusp to the point ``z`` in the upper half-plane.
 */
  PyObject *__pyx_v_use_initial_bd_d = ((PyObject *)Py_True);
  PyObject *__pyx_v_ideal_basis = NULL;
  PyObject *__pyx_v_lattice_basis = NULL;
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_v_candidate_cusp = NULL;
  PyObject *__pyx_v_dist = NULL;
  PyObject *__pyx_v_norm_bound_sigma = NULL;
  PyObject *__pyx_v_one = NULL;
  PyObject *__pyx_v_coordinate_bounds = NULL;
  PyObject *__pyx_v_embedding_bounds = NULL;
  PyObject *__pyx_v_sigma_candidates_coordinates = NULL;
  PyObject *__pyx_v_sigma_candidates = NULL;
  PyObject *__pyx_v_quotients = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_q = NULL;
  PyObject *__pyx_v_ngcd = NULL;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_v_rho_coordinate_bounds = NULL;
  PyObject *__pyx_v_rho_embedding_bounds = NULL;
  PyObject *__pyx_v_rho_candidates_coordinates = NULL;
  PyObject *__pyx_v_rho_candidates = NULL;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_v_quo = NULL;
  Py_ssize_t __pyx_7genexpr__pyx_v_i;
  Py_ssize_t __pyx_8genexpr1__pyx_v_j;
  PyObject *__pyx_8genexpr2__pyx_v_b = NULL;
  PyObject *__pyx_8genexpr3__pyx_v_b = NULL;
  PyObject *__pyx_8genexpr4__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *(*__pyx_t_15)(PyObject *);
  struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *(*__pyx_t_19)(PyObject *);
  int __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find_candidate_cusps", 0);
  __Pyx_TraceCall("find_candidate_cusps", __pyx_f[0], 156, 0, __PYX_ERR(0, 156, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_use_lll = __pyx_optional_args->use_lll;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_use_norm_bound = __pyx_optional_args->use_norm_bound;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_return_sigma_candidates = __pyx_optional_args->return_sigma_candidates;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_initial_bd_d = __pyx_optional_args->initial_bd_d;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_use_initial_bd_d = __pyx_optional_args->use_initial_bd_d;
            }
          }
        }
      }
    }
  }

  /* "hilbert_modgroup/pullback_cython.pyx":200
 * 
 *     """
 *     ideal_basis = p._construct_ideal(1).integral_basis()             # <<<<<<<<<<<<<<
 *     lattice_basis = p.basis_matrix_ideal()
 *     n = len(lattice_basis[0])
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_construct_ideal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_integral_basis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ideal_basis = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":201
 *     """
 *     ideal_basis = p._construct_ideal(1).integral_basis()
 *     lattice_basis = p.basis_matrix_ideal()             # <<<<<<<<<<<<<<
 *     n = len(lattice_basis[0])
 *     # Make lattice basis to a nested list to avoid creation of FreeModule elements
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_basis_matrix_ideal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_lattice_basis = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":202
 *     ideal_basis = p._construct_ideal(1).integral_basis()
 *     lattice_basis = p.basis_matrix_ideal()
 *     n = len(lattice_basis[0])             # <<<<<<<<<<<<<<
 *     # Make lattice basis to a nested list to avoid creation of FreeModule elements
 *     lattice_basis = [[lattice_basis[i][j] for j in range(n)] for i in range(n)]
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_lattice_basis, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_n = __pyx_t_5;

  /* "hilbert_modgroup/pullback_cython.pyx":204
 *     n = len(lattice_basis[0])
 *     # Make lattice basis to a nested list to avoid creation of FreeModule elements
 *     lattice_basis = [[lattice_basis[i][j] for j in range(n)] for i in range(n)]             # <<<<<<<<<<<<<<
 *     ## Initial bound:
 *     if use_lll:
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __pyx_v_n;
    __pyx_t_6 = __pyx_t_5;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_7genexpr__pyx_v_i = __pyx_t_7;
      { /* enter inner scope */
        __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = __pyx_v_n;
        __pyx_t_9 = __pyx_t_8;
        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_8genexpr1__pyx_v_j = __pyx_t_10;
          __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_lattice_basis, __pyx_7genexpr__pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, __pyx_8genexpr1__pyx_v_j, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 204, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      } /* exit inner scope */
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_lattice_basis, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":206
 *     lattice_basis = [[lattice_basis[i][j] for j in range(n)] for i in range(n)]
 *     ## Initial bound:
 *     if use_lll:             # <<<<<<<<<<<<<<
 *         candidate_cusp = p.get_heuristic_closest_cusp(z)
 *     else:
 */
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_use_lll); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 206, __pyx_L1_error)
  if (__pyx_t_11) {

    /* "hilbert_modgroup/pullback_cython.pyx":207
 *     ## Initial bound:
 *     if use_lll:
 *         candidate_cusp = p.get_heuristic_closest_cusp(z)             # <<<<<<<<<<<<<<
 *     else:
 *         candidate_cusp = None
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_get_heuristic_closest_cusp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_z) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_z);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_candidate_cusp = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":206
 *     lattice_basis = [[lattice_basis[i][j] for j in range(n)] for i in range(n)]
 *     ## Initial bound:
 *     if use_lll:             # <<<<<<<<<<<<<<
 *         candidate_cusp = p.get_heuristic_closest_cusp(z)
 *     else:
 */
    goto __pyx_L7;
  }

  /* "hilbert_modgroup/pullback_cython.pyx":209
 *         candidate_cusp = p.get_heuristic_closest_cusp(z)
 *     else:
 *         candidate_cusp = None             # <<<<<<<<<<<<<<
 *     if candidate_cusp and use_initial_bd_d:
 *         dist = distance_to_cusp(p, candidate_cusp[0], candidate_cusp[1], z)
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_candidate_cusp = Py_None;
  }
  __pyx_L7:;

  /* "hilbert_modgroup/pullback_cython.pyx":210
 *     else:
 *         candidate_cusp = None
 *     if candidate_cusp and use_initial_bd_d:             # <<<<<<<<<<<<<<
 *         dist = distance_to_cusp(p, candidate_cusp[0], candidate_cusp[1], z)
 *     else:
 */
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_candidate_cusp); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
  if (__pyx_t_12) {
  } else {
    __pyx_t_11 = __pyx_t_12;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_use_initial_bd_d); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
  __pyx_t_11 = __pyx_t_12;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_11) {

    /* "hilbert_modgroup/pullback_cython.pyx":211
 *         candidate_cusp = None
 *     if candidate_cusp and use_initial_bd_d:
 *         dist = distance_to_cusp(p, candidate_cusp[0], candidate_cusp[1], z)             # <<<<<<<<<<<<<<
 *     else:
 *         dist = None
 */
    if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_4sage_9structure_11sage_object_SageObject))))) __PYX_ERR(0, 211, __pyx_L1_error)
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement))))) __PYX_ERR(0, 211, __pyx_L1_error)
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement))))) __PYX_ERR(0, 211, __pyx_L1_error)
    if (!(likely(((__pyx_v_z) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_z, __pyx_ptype_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class))))) __PYX_ERR(0, 211, __pyx_L1_error)
    __pyx_t_4 = __pyx_f_16hilbert_modgroup_15pullback_cython_distance_to_cusp(((struct __pyx_obj_4sage_9structure_11sage_object_SageObject *)__pyx_v_p), ((struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *)__pyx_t_1), ((struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *)__pyx_t_3), ((struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *)__pyx_v_z), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dist = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":210
 *     else:
 *         candidate_cusp = None
 *     if candidate_cusp and use_initial_bd_d:             # <<<<<<<<<<<<<<
 *         dist = distance_to_cusp(p, candidate_cusp[0], candidate_cusp[1], z)
 *     else:
 */
    goto __pyx_L8;
  }

  /* "hilbert_modgroup/pullback_cython.pyx":213
 *         dist = distance_to_cusp(p, candidate_cusp[0], candidate_cusp[1], z)
 *     else:
 *         dist = None             # <<<<<<<<<<<<<<
 *     if use_norm_bound:
 *         norm_bound_sigma = p._bound_for_sigma_norm(z, dist)
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_dist = Py_None;
  }
  __pyx_L8:;

  /* "hilbert_modgroup/pullback_cython.pyx":214
 *     else:
 *         dist = None
 *     if use_norm_bound:             # <<<<<<<<<<<<<<
 *         norm_bound_sigma = p._bound_for_sigma_norm(z, dist)
 *         norm_bound_sigma = norm_bound_sigma*(1+2**(-z[0].prec()/2)) # correct for numerical errors
 */
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_use_norm_bound); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 214, __pyx_L1_error)
  if (__pyx_t_11) {

    /* "hilbert_modgroup/pullback_cython.pyx":215
 *         dist = None
 *     if use_norm_bound:
 *         norm_bound_sigma = p._bound_for_sigma_norm(z, dist)             # <<<<<<<<<<<<<<
 *         norm_bound_sigma = norm_bound_sigma*(1+2**(-z[0].prec()/2)) # correct for numerical errors
 *     else:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_bound_for_sigma_norm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    __pyx_t_13 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_13 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_z, __pyx_v_dist};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_z, __pyx_v_dist};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_v_z);
      __Pyx_GIVEREF(__pyx_v_z);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_13, __pyx_v_z);
      __Pyx_INCREF(__pyx_v_dist);
      __Pyx_GIVEREF(__pyx_v_dist);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_13, __pyx_v_dist);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_norm_bound_sigma = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":216
 *     if use_norm_bound:
 *         norm_bound_sigma = p._bound_for_sigma_norm(z, dist)
 *         norm_bound_sigma = norm_bound_sigma*(1+2**(-z[0].prec()/2)) # correct for numerical errors             # <<<<<<<<<<<<<<
 *     else:
 *         norm_bound_sigma = None
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_z, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_prec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Negative(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_2, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_t_4, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_2, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_norm_bound_sigma, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_norm_bound_sigma, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":214
 *     else:
 *         dist = None
 *     if use_norm_bound:             # <<<<<<<<<<<<<<
 *         norm_bound_sigma = p._bound_for_sigma_norm(z, dist)
 *         norm_bound_sigma = norm_bound_sigma*(1+2**(-z[0].prec()/2)) # correct for numerical errors
 */
    goto __pyx_L11;
  }

  /* "hilbert_modgroup/pullback_cython.pyx":218
 *         norm_bound_sigma = norm_bound_sigma*(1+2**(-z[0].prec()/2)) # correct for numerical errors
 *     else:
 *         norm_bound_sigma = None             # <<<<<<<<<<<<<<
 *     if use_initial_bd_d and initial_bd_d and (not dist or dist > initial_bd_d):
 *         dist = initial_bd_d
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_norm_bound_sigma = Py_None;
  }
  __pyx_L11:;

  /* "hilbert_modgroup/pullback_cython.pyx":219
 *     else:
 *         norm_bound_sigma = None
 *     if use_initial_bd_d and initial_bd_d and (not dist or dist > initial_bd_d):             # <<<<<<<<<<<<<<
 *         dist = initial_bd_d
 *         # norm_bound_rho = p._bound_for_rho_norm(z, dist)
 */
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_use_initial_bd_d); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
  if (__pyx_t_12) {
  } else {
    __pyx_t_11 = __pyx_t_12;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_initial_bd_d); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
  if (__pyx_t_12) {
  } else {
    __pyx_t_11 = __pyx_t_12;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_dist); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
  __pyx_t_14 = ((!__pyx_t_12) != 0);
  if (!__pyx_t_14) {
  } else {
    __pyx_t_11 = __pyx_t_14;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_dist, __pyx_v_initial_bd_d, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error)
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __pyx_t_14;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_11) {

    /* "hilbert_modgroup/pullback_cython.pyx":220
 *         norm_bound_sigma = None
 *     if use_initial_bd_d and initial_bd_d and (not dist or dist > initial_bd_d):
 *         dist = initial_bd_d             # <<<<<<<<<<<<<<
 *         # norm_bound_rho = p._bound_for_rho_norm(z, dist)
 *     one = p.number_field()(1)
 */
    __Pyx_INCREF(__pyx_v_initial_bd_d);
    __Pyx_DECREF_SET(__pyx_v_dist, __pyx_v_initial_bd_d);

    /* "hilbert_modgroup/pullback_cython.pyx":219
 *     else:
 *         norm_bound_sigma = None
 *     if use_initial_bd_d and initial_bd_d and (not dist or dist > initial_bd_d):             # <<<<<<<<<<<<<<
 *         dist = initial_bd_d
 *         # norm_bound_rho = p._bound_for_rho_norm(z, dist)
 */
  }

  /* "hilbert_modgroup/pullback_cython.pyx":222
 *         dist = initial_bd_d
 *         # norm_bound_rho = p._bound_for_rho_norm(z, dist)
 *     one = p.number_field()(1)             # <<<<<<<<<<<<<<
 *     coordinate_bounds = p._bound_for_sigma_coordinates(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)
 *     embedding_bounds = p._bound_for_sigma_embeddings(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_number_field); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_one = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":223
 *         # norm_bound_rho = p._bound_for_rho_norm(z, dist)
 *     one = p.number_field()(1)
 *     coordinate_bounds = p._bound_for_sigma_coordinates(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)             # <<<<<<<<<<<<<<
 *     embedding_bounds = p._bound_for_sigma_embeddings(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)
 *     coordinate_bounds = [(-b,b) for b in coordinate_bounds]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_bound_for_sigma_coordinates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_z);
  __Pyx_GIVEREF(__pyx_v_z);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_z);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_initial_bd_d, __pyx_v_dist) < 0) __PYX_ERR(0, 223, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_use_initial_bd_d, __pyx_v_use_initial_bd_d) < 0) __PYX_ERR(0, 223, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_coordinate_bounds = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":224
 *     one = p.number_field()(1)
 *     coordinate_bounds = p._bound_for_sigma_coordinates(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)
 *     embedding_bounds = p._bound_for_sigma_embeddings(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)             # <<<<<<<<<<<<<<
 *     coordinate_bounds = [(-b,b) for b in coordinate_bounds]
 *     embedding_bounds = [(-b,b) for b in embedding_bounds]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_bound_for_sigma_embeddings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_z);
  __Pyx_GIVEREF(__pyx_v_z);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_z);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_initial_bd_d, __pyx_v_dist) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_use_initial_bd_d, __pyx_v_use_initial_bd_d) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_embedding_bounds = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":225
 *     coordinate_bounds = p._bound_for_sigma_coordinates(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)
 *     embedding_bounds = p._bound_for_sigma_embeddings(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)
 *     coordinate_bounds = [(-b,b) for b in coordinate_bounds]             # <<<<<<<<<<<<<<
 *     embedding_bounds = [(-b,b) for b in embedding_bounds]
 *     sigma_candidates_coordinates = lattice_elements_in_box(lattice_basis,
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L19_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_v_coordinate_bounds)) || PyTuple_CheckExact(__pyx_v_coordinate_bounds)) {
      __pyx_t_4 = __pyx_v_coordinate_bounds; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
      __pyx_t_15 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_coordinate_bounds); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L19_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 225, __pyx_L19_error)
    }
    for (;;) {
      if (likely(!__pyx_t_15)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L19_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L19_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L19_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L19_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_15(__pyx_t_4);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 225, __pyx_L19_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_b, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Negative(__pyx_8genexpr2__pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L19_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L19_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __Pyx_INCREF(__pyx_8genexpr2__pyx_v_b);
      __Pyx_GIVEREF(__pyx_8genexpr2__pyx_v_b);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_8genexpr2__pyx_v_b);
      __pyx_t_3 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 225, __pyx_L19_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_b); __pyx_8genexpr2__pyx_v_b = 0;
    goto __pyx_L22_exit_scope;
    __pyx_L19_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_b); __pyx_8genexpr2__pyx_v_b = 0;
    goto __pyx_L1_error;
    __pyx_L22_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_coordinate_bounds, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":226
 *     embedding_bounds = p._bound_for_sigma_embeddings(z, initial_bd_d=dist,use_initial_bd_d=use_initial_bd_d)
 *     coordinate_bounds = [(-b,b) for b in coordinate_bounds]
 *     embedding_bounds = [(-b,b) for b in embedding_bounds]             # <<<<<<<<<<<<<<
 *     sigma_candidates_coordinates = lattice_elements_in_box(lattice_basis,
 *                                                embedding_bounds,
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L25_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_v_embedding_bounds)) || PyTuple_CheckExact(__pyx_v_embedding_bounds)) {
      __pyx_t_4 = __pyx_v_embedding_bounds; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
      __pyx_t_15 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_embedding_bounds); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L25_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 226, __pyx_L25_error)
    }
    for (;;) {
      if (likely(!__pyx_t_15)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 226, __pyx_L25_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 226, __pyx_L25_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L25_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_15(__pyx_t_4);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 226, __pyx_L25_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_b, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Negative(__pyx_8genexpr3__pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L25_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L25_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_INCREF(__pyx_8genexpr3__pyx_v_b);
      __Pyx_GIVEREF(__pyx_8genexpr3__pyx_v_b);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_8genexpr3__pyx_v_b);
      __pyx_t_1 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 226, __pyx_L25_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_b); __pyx_8genexpr3__pyx_v_b = 0;
    goto __pyx_L28_exit_scope;
    __pyx_L25_error:;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_b); __pyx_8genexpr3__pyx_v_b = 0;
    goto __pyx_L1_error;
    __pyx_L28_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_embedding_bounds, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":227
 *     coordinate_bounds = [(-b,b) for b in coordinate_bounds]
 *     embedding_bounds = [(-b,b) for b in embedding_bounds]
 *     sigma_candidates_coordinates = lattice_elements_in_box(lattice_basis,             # <<<<<<<<<<<<<<
 *                                                embedding_bounds,
 *                                                coordinate_bounds, norm_bound=norm_bound_sigma)
 */
  __pyx_t_16.__pyx_n = 1;
  __pyx_t_16.norm_bound = __pyx_v_norm_bound_sigma;
  __pyx_t_2 = __pyx_f_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box(__pyx_v_lattice_basis, __pyx_v_embedding_bounds, __pyx_v_coordinate_bounds, 0, &__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_sigma_candidates_coordinates = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":230
 *                                                embedding_bounds,
 *                                                coordinate_bounds, norm_bound=norm_bound_sigma)
 *     sigma_candidates = coordinates_to_ideal_elements(sigma_candidates_coordinates,             # <<<<<<<<<<<<<<
 *                                                              ideal_basis)
 *     if return_sigma_candidates:
 */
  __pyx_t_2 = __pyx_f_16hilbert_modgroup_15pullback_cython_coordinates_to_ideal_elements(__pyx_v_sigma_candidates_coordinates, __pyx_v_ideal_basis, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_sigma_candidates = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":232
 *     sigma_candidates = coordinates_to_ideal_elements(sigma_candidates_coordinates,
 *                                                              ideal_basis)
 *     if return_sigma_candidates:             # <<<<<<<<<<<<<<
 *         return sigma_candidates
 *     # To remove duplicates we keep track of the quotients rho/sigma (for sigma !=0)
 */
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_return_sigma_candidates); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 232, __pyx_L1_error)
  if (__pyx_t_11) {

    /* "hilbert_modgroup/pullback_cython.pyx":233
 *                                                              ideal_basis)
 *     if return_sigma_candidates:
 *         return sigma_candidates             # <<<<<<<<<<<<<<
 *     # To remove duplicates we keep track of the quotients rho/sigma (for sigma !=0)
 *     quotients = {}
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_sigma_candidates);
    __pyx_r = __pyx_v_sigma_candidates;
    goto __pyx_L0;

    /* "hilbert_modgroup/pullback_cython.pyx":232
 *     sigma_candidates = coordinates_to_ideal_elements(sigma_candidates_coordinates,
 *                                                              ideal_basis)
 *     if return_sigma_candidates:             # <<<<<<<<<<<<<<
 *         return sigma_candidates
 *     # To remove duplicates we keep track of the quotients rho/sigma (for sigma !=0)
 */
  }

  /* "hilbert_modgroup/pullback_cython.pyx":235
 *         return sigma_candidates
 *     # To remove duplicates we keep track of the quotients rho/sigma (for sigma !=0)
 *     quotients = {}             # <<<<<<<<<<<<<<
 *     if not candidate_cusp or candidate_cusp[1] == 0:
 *         result = [(p.number_field()(1), p.number_field()(0))]
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_quotients = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":236
 *     # To remove duplicates we keep track of the quotients rho/sigma (for sigma !=0)
 *     quotients = {}
 *     if not candidate_cusp or candidate_cusp[1] == 0:             # <<<<<<<<<<<<<<
 *         result = [(p.number_field()(1), p.number_field()(0))]
 *     elif candidate_cusp[0] == 0:
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_candidate_cusp); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 236, __pyx_L1_error)
  __pyx_t_12 = ((!__pyx_t_14) != 0);
  if (!__pyx_t_12) {
  } else {
    __pyx_t_11 = __pyx_t_12;
    goto __pyx_L31_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __pyx_t_12;
  __pyx_L31_bool_binop_done:;
  if (__pyx_t_11) {

    /* "hilbert_modgroup/pullback_cython.pyx":237
 *     quotients = {}
 *     if not candidate_cusp or candidate_cusp[1] == 0:
 *         result = [(p.number_field()(1), p.number_field()(0))]             # <<<<<<<<<<<<<<
 *     elif candidate_cusp[0] == 0:
 *         result = [(p.number_field()(0), p.number_field()(1))]
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_number_field); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_number_field); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_17) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_17) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_0);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_result = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":236
 *     # To remove duplicates we keep track of the quotients rho/sigma (for sigma !=0)
 *     quotients = {}
 *     if not candidate_cusp or candidate_cusp[1] == 0:             # <<<<<<<<<<<<<<
 *         result = [(p.number_field()(1), p.number_field()(0))]
 *     elif candidate_cusp[0] == 0:
 */
    goto __pyx_L30;
  }

  /* "hilbert_modgroup/pullback_cython.pyx":238
 *     if not candidate_cusp or candidate_cusp[1] == 0:
 *         result = [(p.number_field()(1), p.number_field()(0))]
 *     elif candidate_cusp[0] == 0:             # <<<<<<<<<<<<<<
 *         result = [(p.number_field()(0), p.number_field()(1))]
 *     else:
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_11) {

    /* "hilbert_modgroup/pullback_cython.pyx":239
 *         result = [(p.number_field()(1), p.number_field()(0))]
 *     elif candidate_cusp[0] == 0:
 *         result = [(p.number_field()(0), p.number_field()(1))]             # <<<<<<<<<<<<<<
 *     else:
 *         # We always have infinity since sigma=0 is always within the bounds.
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_number_field); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_0);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_number_field); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_4 = (__pyx_t_17) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_17) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_1);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_result = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":238
 *     if not candidate_cusp or candidate_cusp[1] == 0:
 *         result = [(p.number_field()(1), p.number_field()(0))]
 *     elif candidate_cusp[0] == 0:             # <<<<<<<<<<<<<<
 *         result = [(p.number_field()(0), p.number_field()(1))]
 *     else:
 */
    goto __pyx_L30;
  }

  /* "hilbert_modgroup/pullback_cython.pyx":242
 *     else:
 *         # We always have infinity since sigma=0 is always within the bounds.
 *         result = [candidate_cusp,(p.number_field()(1), p.number_field()(0))]             # <<<<<<<<<<<<<<
 *         q = candidate_cusp[0]/candidate_cusp[1]
 *         ngcd = gcd(candidate_cusp[0].norm(),candidate_cusp[1].norm())
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_number_field); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && 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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_number_field); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_17) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_17) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_0);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_candidate_cusp);
    __Pyx_GIVEREF(__pyx_v_candidate_cusp);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_candidate_cusp);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_result = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":243
 *         # We always have infinity since sigma=0 is always within the bounds.
 *         result = [candidate_cusp,(p.number_field()(1), p.number_field()(0))]
 *         q = candidate_cusp[0]/candidate_cusp[1]             # <<<<<<<<<<<<<<
 *         ngcd = gcd(candidate_cusp[0].norm(),candidate_cusp[1].norm())
 *         quotients = {q: (ngcd,(candidate_cusp[0],candidate_cusp[1]))}
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_q = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":244
 *         result = [candidate_cusp,(p.number_field()(1), p.number_field()(0))]
 *         q = candidate_cusp[0]/candidate_cusp[1]
 *         ngcd = gcd(candidate_cusp[0].norm(),candidate_cusp[1].norm())             # <<<<<<<<<<<<<<
 *         quotients = {q: (ngcd,(candidate_cusp[0],candidate_cusp[1]))}
 *     for s in sigma_candidates:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_gcd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_norm); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_17);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_17, function);
      }
    }
    __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_17);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_norm); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_18))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_18);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_18, function);
      }
    }
    __pyx_t_17 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_18);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    __pyx_t_18 = NULL;
    __pyx_t_13 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_18)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_18);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_13 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_4, __pyx_t_17};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_4, __pyx_t_17};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__pyx_t_18) {
        __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_18); __pyx_t_18 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_13, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_17);
      PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_13, __pyx_t_17);
      __pyx_t_4 = 0;
      __pyx_t_17 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __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_v_ngcd = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":245
 *         q = candidate_cusp[0]/candidate_cusp[1]
 *         ngcd = gcd(candidate_cusp[0].norm(),candidate_cusp[1].norm())
 *         quotients = {q: (ngcd,(candidate_cusp[0],candidate_cusp[1]))}             # <<<<<<<<<<<<<<
 *     for s in sigma_candidates:
 *         if s == 0:
 */
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_candidate_cusp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_1);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_ngcd);
    __Pyx_GIVEREF(__pyx_v_ngcd);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ngcd);
    __Pyx_GIVEREF(__pyx_t_17);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_17);
    __pyx_t_17 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_v_q, __pyx_t_1) < 0) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_quotients, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;
  }
  __pyx_L30:;

  /* "hilbert_modgroup/pullback_cython.pyx":246
 *         ngcd = gcd(candidate_cusp[0].norm(),candidate_cusp[1].norm())
 *         quotients = {q: (ngcd,(candidate_cusp[0],candidate_cusp[1]))}
 *     for s in sigma_candidates:             # <<<<<<<<<<<<<<
 *         if s == 0:
 *             continue
 */
  if (likely(PyList_CheckExact(__pyx_v_sigma_candidates)) || PyTuple_CheckExact(__pyx_v_sigma_candidates)) {
    __pyx_t_2 = __pyx_v_sigma_candidates; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
    __pyx_t_15 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_sigma_candidates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 246, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_15)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 246, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 246, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_15(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 246, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":247
 *         quotients = {q: (ngcd,(candidate_cusp[0],candidate_cusp[1]))}
 *     for s in sigma_candidates:
 *         if s == 0:             # <<<<<<<<<<<<<<
 *             continue
 *         rho_coordinate_bounds = p._bound_for_rho_coordinates(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_s, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_11) {

      /* "hilbert_modgroup/pullback_cython.pyx":248
 *     for s in sigma_candidates:
 *         if s == 0:
 *             continue             # <<<<<<<<<<<<<<
 *         rho_coordinate_bounds = p._bound_for_rho_coordinates(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)
 *         rho_coordinate_bounds = [(-b,b) for b in rho_coordinate_bounds]
 */
      goto __pyx_L33_continue;

      /* "hilbert_modgroup/pullback_cython.pyx":247
 *         quotients = {q: (ngcd,(candidate_cusp[0],candidate_cusp[1]))}
 *     for s in sigma_candidates:
 *         if s == 0:             # <<<<<<<<<<<<<<
 *             continue
 *         rho_coordinate_bounds = p._bound_for_rho_coordinates(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":249
 *         if s == 0:
 *             continue
 *         rho_coordinate_bounds = p._bound_for_rho_coordinates(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)             # <<<<<<<<<<<<<<
 *         rho_coordinate_bounds = [(-b,b) for b in rho_coordinate_bounds]
 *         rho_embedding_bounds = p._bound_for_rho_embeddings(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_bound_for_rho_coordinates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_INCREF(__pyx_v_z);
    __Pyx_GIVEREF(__pyx_v_z);
    PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_z);
    __Pyx_INCREF(__pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_s);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_initial_bd_d, __pyx_v_dist) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_use_initial_bd_d, __pyx_v_use_initial_bd_d) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_rho_coordinate_bounds, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":250
 *             continue
 *         rho_coordinate_bounds = p._bound_for_rho_coordinates(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)
 *         rho_coordinate_bounds = [(-b,b) for b in rho_coordinate_bounds]             # <<<<<<<<<<<<<<
 *         rho_embedding_bounds = p._bound_for_rho_embeddings(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)
 * 
 */
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L38_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(__pyx_v_rho_coordinate_bounds)) || PyTuple_CheckExact(__pyx_v_rho_coordinate_bounds)) {
        __pyx_t_3 = __pyx_v_rho_coordinate_bounds; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
        __pyx_t_19 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_rho_coordinate_bounds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L38_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_19 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 250, __pyx_L38_error)
      }
      for (;;) {
        if (likely(!__pyx_t_19)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_17 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 250, __pyx_L38_error)
            #else
            __pyx_t_17 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 250, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_17);
            #endif
          } else {
            if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 250, __pyx_L38_error)
            #else
            __pyx_t_17 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 250, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_17);
            #endif
          }
        } else {
          __pyx_t_17 = __pyx_t_19(__pyx_t_3);
          if (unlikely(!__pyx_t_17)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 250, __pyx_L38_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_17);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_b, __pyx_t_17);
        __pyx_t_17 = 0;
        __pyx_t_17 = PyNumber_Negative(__pyx_8genexpr4__pyx_v_b); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 250, __pyx_L38_error)
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L38_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_17);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_17);
        __Pyx_INCREF(__pyx_8genexpr4__pyx_v_b);
        __Pyx_GIVEREF(__pyx_8genexpr4__pyx_v_b);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_8genexpr4__pyx_v_b);
        __pyx_t_17 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 250, __pyx_L38_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_b); __pyx_8genexpr4__pyx_v_b = 0;
      goto __pyx_L41_exit_scope;
      __pyx_L38_error:;
      __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_b); __pyx_8genexpr4__pyx_v_b = 0;
      goto __pyx_L1_error;
      __pyx_L41_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_rho_coordinate_bounds, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":251
 *         rho_coordinate_bounds = p._bound_for_rho_coordinates(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)
 *         rho_coordinate_bounds = [(-b,b) for b in rho_coordinate_bounds]
 *         rho_embedding_bounds = p._bound_for_rho_embeddings(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)             # <<<<<<<<<<<<<<
 * 
 *         rho_candidates_coordinates = lattice_elements_in_box(lattice_basis,
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_bound_for_rho_embeddings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_z);
    __Pyx_GIVEREF(__pyx_v_z);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_z);
    __Pyx_INCREF(__pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_s);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_initial_bd_d, __pyx_v_dist) < 0) __PYX_ERR(0, 251, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_use_initial_bd_d, __pyx_v_use_initial_bd_d) < 0) __PYX_ERR(0, 251, __pyx_L1_error)
    __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_rho_embedding_bounds, __pyx_t_17);
    __pyx_t_17 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":253
 *         rho_embedding_bounds = p._bound_for_rho_embeddings(z, s, initial_bd_d=dist, use_initial_bd_d=use_initial_bd_d)
 * 
 *         rho_candidates_coordinates = lattice_elements_in_box(lattice_basis,             # <<<<<<<<<<<<<<
 *                                                  rho_embedding_bounds,
 *                                                  rho_coordinate_bounds)
 */
    __pyx_t_17 = __pyx_f_16hilbert_modgroup_15pullback_cython_lattice_elements_in_box(__pyx_v_lattice_basis, __pyx_v_rho_embedding_bounds, __pyx_v_rho_coordinate_bounds, 0, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_XDECREF_SET(__pyx_v_rho_candidates_coordinates, __pyx_t_17);
    __pyx_t_17 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":256
 *                                                  rho_embedding_bounds,
 *                                                  rho_coordinate_bounds)
 *         rho_candidates = coordinates_to_ideal_elements(rho_candidates_coordinates,             # <<<<<<<<<<<<<<
 *                                                          ideal_basis)
 * 
 */
    __pyx_t_17 = __pyx_f_16hilbert_modgroup_15pullback_cython_coordinates_to_ideal_elements(__pyx_v_rho_candidates_coordinates, __pyx_v_ideal_basis, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_XDECREF_SET(__pyx_v_rho_candidates, __pyx_t_17);
    __pyx_t_17 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":259
 *                                                          ideal_basis)
 * 
 *         for r in rho_candidates:             # <<<<<<<<<<<<<<
 *             if r == 0 and (r,one) not in result:
 *                 result.append((r,one))
 */
    if (likely(PyList_CheckExact(__pyx_v_rho_candidates)) || PyTuple_CheckExact(__pyx_v_rho_candidates)) {
      __pyx_t_17 = __pyx_v_rho_candidates; __Pyx_INCREF(__pyx_t_17); __pyx_t_6 = 0;
      __pyx_t_19 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_17 = PyObject_GetIter(__pyx_v_rho_candidates); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_19 = Py_TYPE(__pyx_t_17)->tp_iternext; if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 259, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_19)) {
        if (likely(PyList_CheckExact(__pyx_t_17))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_17)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_17, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_17, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_17)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_17, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_17, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_19(__pyx_t_17);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 259, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":260
 * 
 *         for r in rho_candidates:
 *             if r == 0 and (r,one) not in result:             # <<<<<<<<<<<<<<
 *                 result.append((r,one))
 *             if r == 0:
 */
      __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_r, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_12) {
      } else {
        __pyx_t_11 = __pyx_t_12;
        goto __pyx_L45_bool_binop_done;
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_r);
      __Pyx_GIVEREF(__pyx_v_r);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_r);
      __Pyx_INCREF(__pyx_v_one);
      __Pyx_GIVEREF(__pyx_v_one);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_one);
      __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_v_result, Py_NE)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_14 = (__pyx_t_12 != 0);
      __pyx_t_11 = __pyx_t_14;
      __pyx_L45_bool_binop_done:;
      if (__pyx_t_11) {

        /* "hilbert_modgroup/pullback_cython.pyx":261
 *         for r in rho_candidates:
 *             if r == 0 and (r,one) not in result:
 *                 result.append((r,one))             # <<<<<<<<<<<<<<
 *             if r == 0:
 *                 continue
 */
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_r);
        __Pyx_GIVEREF(__pyx_v_r);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_r);
        __Pyx_INCREF(__pyx_v_one);
        __Pyx_GIVEREF(__pyx_v_one);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_one);
        __pyx_t_20 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 261, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "hilbert_modgroup/pullback_cython.pyx":260
 * 
 *         for r in rho_candidates:
 *             if r == 0 and (r,one) not in result:             # <<<<<<<<<<<<<<
 *                 result.append((r,one))
 *             if r == 0:
 */
      }

      /* "hilbert_modgroup/pullback_cython.pyx":262
 *             if r == 0 and (r,one) not in result:
 *                 result.append((r,one))
 *             if r == 0:             # <<<<<<<<<<<<<<
 *                 continue
 *             quo = r/s
 */
      __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_r, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 262, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_11) {

        /* "hilbert_modgroup/pullback_cython.pyx":263
 *                 result.append((r,one))
 *             if r == 0:
 *                 continue             # <<<<<<<<<<<<<<
 *             quo = r/s
 *             ngcd = gcd(r.norm(), s.norm())
 */
        goto __pyx_L42_continue;

        /* "hilbert_modgroup/pullback_cython.pyx":262
 *             if r == 0 and (r,one) not in result:
 *                 result.append((r,one))
 *             if r == 0:             # <<<<<<<<<<<<<<
 *                 continue
 *             quo = r/s
 */
      }

      /* "hilbert_modgroup/pullback_cython.pyx":264
 *             if r == 0:
 *                 continue
 *             quo = r/s             # <<<<<<<<<<<<<<
 *             ngcd = gcd(r.norm(), s.norm())
 *             if quo in quotients:
 */
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_r, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_quo, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":265
 *                 continue
 *             quo = r/s
 *             ngcd = gcd(r.norm(), s.norm())             # <<<<<<<<<<<<<<
 *             if quo in quotients:
 *                 # We try to pick the representative cusp that has the smallest norm gcd
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_gcd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_r, __pyx_n_s_norm); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_21 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_18))) {
        __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_18);
        if (likely(__pyx_t_21)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
          __Pyx_INCREF(__pyx_t_21);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_18, function);
        }
      }
      __pyx_t_4 = (__pyx_t_21) ? __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_21) : __Pyx_PyObject_CallNoArg(__pyx_t_18);
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_norm); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      __pyx_t_22 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_21))) {
        __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_21);
        if (likely(__pyx_t_22)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
          __Pyx_INCREF(__pyx_t_22);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_21, function);
        }
      }
      __pyx_t_18 = (__pyx_t_22) ? __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_22) : __Pyx_PyObject_CallNoArg(__pyx_t_21);
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      __pyx_t_21 = NULL;
      __pyx_t_13 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_21)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_21);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_13 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_4, __pyx_t_18};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_4, __pyx_t_18};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      } else
      #endif
      {
        __pyx_t_22 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 265, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_22);
        if (__pyx_t_21) {
          __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_21); __pyx_t_21 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_13, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_18);
        PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_13, __pyx_t_18);
        __pyx_t_4 = 0;
        __pyx_t_18 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ngcd, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":266
 *             quo = r/s
 *             ngcd = gcd(r.norm(), s.norm())
 *             if quo in quotients:             # <<<<<<<<<<<<<<
 *                 # We try to pick the representative cusp that has the smallest norm gcd
 *                 if ngcd < quotients[quo][0]:
 */
      __pyx_t_11 = (__Pyx_PyDict_ContainsTF(__pyx_v_quo, __pyx_v_quotients, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
      __pyx_t_14 = (__pyx_t_11 != 0);
      if (__pyx_t_14) {

        /* "hilbert_modgroup/pullback_cython.pyx":268
 *             if quo in quotients:
 *                 # We try to pick the representative cusp that has the smallest norm gcd
 *                 if ngcd < quotients[quo][0]:             # <<<<<<<<<<<<<<
 *                     result.remove(quotients[quo][1])
 *                 else:
 */
        __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_quotients, __pyx_v_quo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_ngcd, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 268, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_14) {

          /* "hilbert_modgroup/pullback_cython.pyx":269
 *                 # We try to pick the representative cusp that has the smallest norm gcd
 *                 if ngcd < quotients[quo][0]:
 *                     result.remove(quotients[quo][1])             # <<<<<<<<<<<<<<
 *                 else:
 *                     continue
 */
          __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_quotients, __pyx_v_quo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_remove, __pyx_v_result, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "hilbert_modgroup/pullback_cython.pyx":268
 *             if quo in quotients:
 *                 # We try to pick the representative cusp that has the smallest norm gcd
 *                 if ngcd < quotients[quo][0]:             # <<<<<<<<<<<<<<
 *                     result.remove(quotients[quo][1])
 *                 else:
 */
          goto __pyx_L49;
        }

        /* "hilbert_modgroup/pullback_cython.pyx":271
 *                     result.remove(quotients[quo][1])
 *                 else:
 *                     continue             # <<<<<<<<<<<<<<
 *             result.append((r,s))
 *             quotients[quo] = (ngcd,(r,s))
 */
        /*else*/ {
          goto __pyx_L42_continue;
        }
        __pyx_L49:;

        /* "hilbert_modgroup/pullback_cython.pyx":266
 *             quo = r/s
 *             ngcd = gcd(r.norm(), s.norm())
 *             if quo in quotients:             # <<<<<<<<<<<<<<
 *                 # We try to pick the representative cusp that has the smallest norm gcd
 *                 if ngcd < quotients[quo][0]:
 */
      }

      /* "hilbert_modgroup/pullback_cython.pyx":272
 *                 else:
 *                     continue
 *             result.append((r,s))             # <<<<<<<<<<<<<<
 *             quotients[quo] = (ngcd,(r,s))
 *     return result
 */
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_r);
      __Pyx_GIVEREF(__pyx_v_r);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_r);
      __Pyx_INCREF(__pyx_v_s);
      __Pyx_GIVEREF(__pyx_v_s);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_s);
      __pyx_t_20 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 272, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":273
 *                     continue
 *             result.append((r,s))
 *             quotients[quo] = (ngcd,(r,s))             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_r);
      __Pyx_GIVEREF(__pyx_v_r);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_r);
      __Pyx_INCREF(__pyx_v_s);
      __Pyx_GIVEREF(__pyx_v_s);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_s);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_ngcd);
      __Pyx_GIVEREF(__pyx_v_ngcd);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ngcd);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_quotients, __pyx_v_quo, __pyx_t_3) < 0)) __PYX_ERR(0, 273, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":259
 *                                                          ideal_basis)
 * 
 *         for r in rho_candidates:             # <<<<<<<<<<<<<<
 *             if r == 0 and (r,one) not in result:
 *                 result.append((r,one))
 */
      __pyx_L42_continue:;
    }
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":246
 *         ngcd = gcd(candidate_cusp[0].norm(),candidate_cusp[1].norm())
 *         quotients = {q: (ngcd,(candidate_cusp[0],candidate_cusp[1]))}
 *     for s in sigma_candidates:             # <<<<<<<<<<<<<<
 *         if s == 0:
 *             continue
 */
    __pyx_L33_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":274
 *             result.append((r,s))
 *             quotients[quo] = (ngcd,(r,s))
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cpdef find_closest_cusp(p, z, return_multiple=False, use_lll=True, use_norm_bound=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "hilbert_modgroup/pullback_cython.pyx":156
 * 
 * 
 * cpdef find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False,             # <<<<<<<<<<<<<<
 *                            initial_bd_d=None,
 *                            use_initial_bd_d=True):
 */

  /* 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_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.find_candidate_cusps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ideal_basis);
  __Pyx_XDECREF(__pyx_v_lattice_basis);
  __Pyx_XDECREF(__pyx_v_candidate_cusp);
  __Pyx_XDECREF(__pyx_v_dist);
  __Pyx_XDECREF(__pyx_v_norm_bound_sigma);
  __Pyx_XDECREF(__pyx_v_one);
  __Pyx_XDECREF(__pyx_v_coordinate_bounds);
  __Pyx_XDECREF(__pyx_v_embedding_bounds);
  __Pyx_XDECREF(__pyx_v_sigma_candidates_coordinates);
  __Pyx_XDECREF(__pyx_v_sigma_candidates);
  __Pyx_XDECREF(__pyx_v_quotients);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XDECREF(__pyx_v_ngcd);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_rho_coordinate_bounds);
  __Pyx_XDECREF(__pyx_v_rho_embedding_bounds);
  __Pyx_XDECREF(__pyx_v_rho_candidates_coordinates);
  __Pyx_XDECREF(__pyx_v_rho_candidates);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_quo);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_b);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_b);
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_7find_candidate_cusps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_16hilbert_modgroup_15pullback_cython_6find_candidate_cusps[] = "find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False, initial_bd_d=None, use_initial_bd_d=True)\n\n    Return candidates for closest cusp to the point ``z`` in the upper half-plane. \n    \n    INPUT:\n    \n    - ``p`` -- object of type HilbertPullback\n    - ``z`` -- point in the upper half-plane\n    - ``use_lll`` -- boolean (default: `True`)  Use the LLL method to find a preliminary bounds\n    - ``use_norm_bound`` -- boolean (default: `True`) Use the norm bound together ith the embedding bounds\n    - ``return_sigma_candidates`` -- boolean (default: `False`) Return a list of sigma candidates only\n    - ``initial_bd_d`` -- positive number (default: `None`) - an initial bound for the distance to nearest cusp.\n    - ``use_initial_bd_d`` -- boolean (default: `False`) Use the initial bound\n    \n    OUTPUT:\n    - list of tuples (sigma,rho) representing cusps \n    \n    EXAMPLES::\n    \n        sage: from hilbert_modgroup.all import *\n        sage: from hilbert_modgroup.pullback_cython import find_candidate_cusps\n        sage: H1 = HilbertModularGroup(5)\n        sage: P1 = HilbertPullback(H1)\n        sage: z=UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])\n        sage: find_candidate_cusps(P1,z)\n        [(1, 0), (-1, -1), (0, 1), (1, -1)]\n        sage: z=UpperHalfPlaneProductElement([CC(0,0.5),CC(0,1)])\n        sage: find_candidate_cusps(P1,z)\n        [(0, 1)]        \n        sage: H2 = HilbertModularGroup(10)\n        sage: P2 = HilbertPullback(H2)\n        sage: z=UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])\n        sage: find_candidate_cusps(P2,z)\n         [(1, 0),\n         ...\n         sage: len(_)\n         10\n        sage: z=UpperHalfPlaneProductElement([CC(2.58,0.5),CC(0.5,0.5)]) # long time (1 second)\n        sage: len(find_candidate_cusps(P2,z)) # long time (1 second)\n        271\n        \n    ";
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_7find_candidate_cusps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_use_lll = 0;
  PyObject *__pyx_v_use_norm_bound = 0;
  PyObject *__pyx_v_return_sigma_candidates = 0;
  PyObject *__pyx_v_initial_bd_d = 0;
  PyObject *__pyx_v_use_initial_bd_d = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_candidate_cusps (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_z,&__pyx_n_s_use_lll,&__pyx_n_s_use_norm_bound,&__pyx_n_s_return_sigma_candidates,&__pyx_n_s_initial_bd_d,&__pyx_n_s_use_initial_bd_d,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_True);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_False);

    /* "hilbert_modgroup/pullback_cython.pyx":157
 * 
 * cpdef find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False,
 *                            initial_bd_d=None,             # <<<<<<<<<<<<<<
 *                            use_initial_bd_d=True):
 *     r"""
 */
    values[5] = ((PyObject *)Py_None);

    /* "hilbert_modgroup/pullback_cython.pyx":158
 * cpdef find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False,
 *                            initial_bd_d=None,
 *                            use_initial_bd_d=True):             # <<<<<<<<<<<<<<
 *     r"""
 *     Return candidates for closest cusp to the point ``z`` in the upper half-plane.
 */
    values[6] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("find_candidate_cusps", 0, 2, 7, 1); __PYX_ERR(0, 156, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_lll);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_norm_bound);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_sigma_candidates);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_initial_bd_d);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_initial_bd_d);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_candidate_cusps") < 0)) __PYX_ERR(0, 156, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_z = values[1];
    __pyx_v_use_lll = values[2];
    __pyx_v_use_norm_bound = values[3];
    __pyx_v_return_sigma_candidates = values[4];
    __pyx_v_initial_bd_d = values[5];
    __pyx_v_use_initial_bd_d = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find_candidate_cusps", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 156, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.find_candidate_cusps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_16hilbert_modgroup_15pullback_cython_6find_candidate_cusps(__pyx_self, __pyx_v_p, __pyx_v_z, __pyx_v_use_lll, __pyx_v_use_norm_bound, __pyx_v_return_sigma_candidates, __pyx_v_initial_bd_d, __pyx_v_use_initial_bd_d);

  /* "hilbert_modgroup/pullback_cython.pyx":156
 * 
 * 
 * cpdef find_candidate_cusps(p, z, use_lll=True, use_norm_bound=True, return_sigma_candidates=False,             # <<<<<<<<<<<<<<
 *                            initial_bd_d=None,
 *                            use_initial_bd_d=True):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_6find_candidate_cusps(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_z, PyObject *__pyx_v_use_lll, PyObject *__pyx_v_use_norm_bound, PyObject *__pyx_v_return_sigma_candidates, PyObject *__pyx_v_initial_bd_d, PyObject *__pyx_v_use_initial_bd_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_candidate_cusps __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find_candidate_cusps", 0);
  __Pyx_TraceCall("find_candidate_cusps (wrapper)", __pyx_f[0], 156, 0, __PYX_ERR(0, 156, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 5;
  __pyx_t_2.use_lll = __pyx_v_use_lll;
  __pyx_t_2.use_norm_bound = __pyx_v_use_norm_bound;
  __pyx_t_2.return_sigma_candidates = __pyx_v_return_sigma_candidates;
  __pyx_t_2.initial_bd_d = __pyx_v_initial_bd_d;
  __pyx_t_2.use_initial_bd_d = __pyx_v_use_initial_bd_d;
  __pyx_t_1 = __pyx_f_16hilbert_modgroup_15pullback_cython_find_candidate_cusps(__pyx_v_p, __pyx_v_z, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __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("hilbert_modgroup.pullback_cython.find_candidate_cusps", __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;
}

/* "hilbert_modgroup/pullback_cython.pyx":276
 *     return result
 * 
 * cpdef find_closest_cusp(p, z, return_multiple=False, use_lll=True, use_norm_bound=True):             # <<<<<<<<<<<<<<
 *     r"""
 *     Return the closest cusp(s) to z
 */

static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_9find_closest_cusp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_find_closest_cusp(PyObject *__pyx_v_p, PyObject *__pyx_v_z, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_closest_cusp *__pyx_optional_args) {
  PyObject *__pyx_v_return_multiple = ((PyObject *)Py_False);
  PyObject *__pyx_v_use_lll = ((PyObject *)Py_True);
  PyObject *__pyx_v_use_norm_bound = ((PyObject *)Py_True);
  PyObject *__pyx_v_cusp_candidates = NULL;
  PyObject *__pyx_v_min_cusp = NULL;
  PyObject *__pyx_v_min_d = NULL;
  PyObject *__pyx_v_min_cusp_bound = NULL;
  double __pyx_v_eps;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_cusp = NULL;
  PyObject *__pyx_v_quo = NULL;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_candidate_cusps __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find_closest_cusp", 0);
  __Pyx_TraceCall("find_closest_cusp", __pyx_f[0], 276, 0, __PYX_ERR(0, 276, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_return_multiple = __pyx_optional_args->return_multiple;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_use_lll = __pyx_optional_args->use_lll;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_use_norm_bound = __pyx_optional_args->use_norm_bound;
        }
      }
    }
  }

  /* "hilbert_modgroup/pullback_cython.pyx":320
 * 
 *     """
 *     cusp_candidates = find_candidate_cusps(p, z, use_lll=use_lll, use_norm_bound=use_norm_bound)             # <<<<<<<<<<<<<<
 *     min_cusp = cusp_candidates[0]
 *     min_d = distance_to_cusp(p,min_cusp[0], min_cusp[1], z)
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.use_lll = __pyx_v_use_lll;
  __pyx_t_2.use_norm_bound = __pyx_v_use_norm_bound;
  __pyx_t_1 = __pyx_f_16hilbert_modgroup_15pullback_cython_find_candidate_cusps(__pyx_v_p, __pyx_v_z, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cusp_candidates = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":321
 *     """
 *     cusp_candidates = find_candidate_cusps(p, z, use_lll=use_lll, use_norm_bound=use_norm_bound)
 *     min_cusp = cusp_candidates[0]             # <<<<<<<<<<<<<<
 *     min_d = distance_to_cusp(p,min_cusp[0], min_cusp[1], z)
 *     if return_multiple:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_cusp_candidates, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_min_cusp = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":322
 *     cusp_candidates = find_candidate_cusps(p, z, use_lll=use_lll, use_norm_bound=use_norm_bound)
 *     min_cusp = cusp_candidates[0]
 *     min_d = distance_to_cusp(p,min_cusp[0], min_cusp[1], z)             # <<<<<<<<<<<<<<
 *     if return_multiple:
 *         min_cusp = [min_cusp]
 */
  if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_4sage_9structure_11sage_object_SageObject))))) __PYX_ERR(0, 322, __pyx_L1_error)
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_min_cusp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement))))) __PYX_ERR(0, 322, __pyx_L1_error)
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_min_cusp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement))))) __PYX_ERR(0, 322, __pyx_L1_error)
  if (!(likely(((__pyx_v_z) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_z, __pyx_ptype_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class))))) __PYX_ERR(0, 322, __pyx_L1_error)
  __pyx_t_4 = __pyx_f_16hilbert_modgroup_15pullback_cython_distance_to_cusp(((struct __pyx_obj_4sage_9structure_11sage_object_SageObject *)__pyx_v_p), ((struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *)__pyx_t_1), ((struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *)__pyx_t_3), ((struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *)__pyx_v_z), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_min_d = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":323
 *     min_cusp = cusp_candidates[0]
 *     min_d = distance_to_cusp(p,min_cusp[0], min_cusp[1], z)
 *     if return_multiple:             # <<<<<<<<<<<<<<
 *         min_cusp = [min_cusp]
 *     min_cusp_bound = p._bound_for_closest_cusp()
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_return_multiple); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 323, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "hilbert_modgroup/pullback_cython.pyx":324
 *     min_d = distance_to_cusp(p,min_cusp[0], min_cusp[1], z)
 *     if return_multiple:
 *         min_cusp = [min_cusp]             # <<<<<<<<<<<<<<
 *     min_cusp_bound = p._bound_for_closest_cusp()
 *     eps = 2.0**(4-53) # Numerical precision for when we consider cusps to be equally close.
 */
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_min_cusp);
    __Pyx_GIVEREF(__pyx_v_min_cusp);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_min_cusp);
    __Pyx_DECREF_SET(__pyx_v_min_cusp, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":323
 *     min_cusp = cusp_candidates[0]
 *     min_d = distance_to_cusp(p,min_cusp[0], min_cusp[1], z)
 *     if return_multiple:             # <<<<<<<<<<<<<<
 *         min_cusp = [min_cusp]
 *     min_cusp_bound = p._bound_for_closest_cusp()
 */
  }

  /* "hilbert_modgroup/pullback_cython.pyx":325
 *     if return_multiple:
 *         min_cusp = [min_cusp]
 *     min_cusp_bound = p._bound_for_closest_cusp()             # <<<<<<<<<<<<<<
 *     eps = 2.0**(4-53) # Numerical precision for when we consider cusps to be equally close.
 *     # There may be many identical cusps in this list.
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_bound_for_closest_cusp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_min_cusp_bound = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":326
 *         min_cusp = [min_cusp]
 *     min_cusp_bound = p._bound_for_closest_cusp()
 *     eps = 2.0**(4-53) # Numerical precision for when we consider cusps to be equally close.             # <<<<<<<<<<<<<<
 *     # There may be many identical cusps in this list.
 *     # In particular there might be many
 */
  __pyx_v_eps = pow(2.0, -49.0);

  /* "hilbert_modgroup/pullback_cython.pyx":329
 *     # There may be many identical cusps in this list.
 *     # In particular there might be many
 *     for c in cusp_candidates[1:]:             # <<<<<<<<<<<<<<
 *         d = distance_to_cusp(p, c[0],c[1], z)
 *         if abs(d-min_d)<eps and return_multiple:
 */
  __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_cusp_candidates, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 329, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 329, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 329, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 329, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":330
 *     # In particular there might be many
 *     for c in cusp_candidates[1:]:
 *         d = distance_to_cusp(p, c[0],c[1], z)             # <<<<<<<<<<<<<<
 *         if abs(d-min_d)<eps and return_multiple:
 *             min_cusp.append(c)
 */
    if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_4sage_9structure_11sage_object_SageObject))))) __PYX_ERR(0, 330, __pyx_L1_error)
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement))))) __PYX_ERR(0, 330, __pyx_L1_error)
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_c, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement))))) __PYX_ERR(0, 330, __pyx_L1_error)
    if (!(likely(((__pyx_v_z) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_z, __pyx_ptype_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class))))) __PYX_ERR(0, 330, __pyx_L1_error)
    __pyx_t_8 = __pyx_f_16hilbert_modgroup_15pullback_cython_distance_to_cusp(((struct __pyx_obj_4sage_9structure_11sage_object_SageObject *)__pyx_v_p), ((struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *)__pyx_t_4), ((struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *)__pyx_t_1), ((struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *)__pyx_v_z), 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":331
 *     for c in cusp_candidates[1:]:
 *         d = distance_to_cusp(p, c[0],c[1], z)
 *         if abs(d-min_d)<eps and return_multiple:             # <<<<<<<<<<<<<<
 *             min_cusp.append(c)
 *         if d < min_d - 2*eps:
 */
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_d, __pyx_v_min_d); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_eps); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_9) {
    } else {
      __pyx_t_5 = __pyx_t_9;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_return_multiple); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 331, __pyx_L1_error)
    __pyx_t_5 = __pyx_t_9;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_5) {

      /* "hilbert_modgroup/pullback_cython.pyx":332
 *         d = distance_to_cusp(p, c[0],c[1], z)
 *         if abs(d-min_d)<eps and return_multiple:
 *             min_cusp.append(c)             # <<<<<<<<<<<<<<
 *         if d < min_d - 2*eps:
 *             if return_multiple:
 */
      __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_min_cusp, __pyx_v_c); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 332, __pyx_L1_error)

      /* "hilbert_modgroup/pullback_cython.pyx":331
 *     for c in cusp_candidates[1:]:
 *         d = distance_to_cusp(p, c[0],c[1], z)
 *         if abs(d-min_d)<eps and return_multiple:             # <<<<<<<<<<<<<<
 *             min_cusp.append(c)
 *         if d < min_d - 2*eps:
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":333
 *         if abs(d-min_d)<eps and return_multiple:
 *             min_cusp.append(c)
 *         if d < min_d - 2*eps:             # <<<<<<<<<<<<<<
 *             if return_multiple:
 *                 min_cusp = [c]
 */
    __pyx_t_4 = PyFloat_FromDouble((2.0 * __pyx_v_eps)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_min_d, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_d, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "hilbert_modgroup/pullback_cython.pyx":334
 *             min_cusp.append(c)
 *         if d < min_d - 2*eps:
 *             if return_multiple:             # <<<<<<<<<<<<<<
 *                 min_cusp = [c]
 *             else:
 */
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_return_multiple); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "hilbert_modgroup/pullback_cython.pyx":335
 *         if d < min_d - 2*eps:
 *             if return_multiple:
 *                 min_cusp = [c]             # <<<<<<<<<<<<<<
 *             else:
 *                 min_cusp = c
 */
        __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 335, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_c);
        __Pyx_GIVEREF(__pyx_v_c);
        PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_c);
        __Pyx_DECREF_SET(__pyx_v_min_cusp, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "hilbert_modgroup/pullback_cython.pyx":334
 *             min_cusp.append(c)
 *         if d < min_d - 2*eps:
 *             if return_multiple:             # <<<<<<<<<<<<<<
 *                 min_cusp = [c]
 *             else:
 */
        goto __pyx_L10;
      }

      /* "hilbert_modgroup/pullback_cython.pyx":337
 *                 min_cusp = [c]
 *             else:
 *                 min_cusp = c             # <<<<<<<<<<<<<<
 *             min_d = d
 *         if d < min_cusp_bound:
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_v_c);
        __Pyx_DECREF_SET(__pyx_v_min_cusp, __pyx_v_c);
      }
      __pyx_L10:;

      /* "hilbert_modgroup/pullback_cython.pyx":338
 *             else:
 *                 min_cusp = c
 *             min_d = d             # <<<<<<<<<<<<<<
 *         if d < min_cusp_bound:
 *             break
 */
      __Pyx_INCREF(__pyx_v_d);
      __Pyx_DECREF_SET(__pyx_v_min_d, __pyx_v_d);

      /* "hilbert_modgroup/pullback_cython.pyx":333
 *         if abs(d-min_d)<eps and return_multiple:
 *             min_cusp.append(c)
 *         if d < min_d - 2*eps:             # <<<<<<<<<<<<<<
 *             if return_multiple:
 *                 min_cusp = [c]
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":339
 *                 min_cusp = c
 *             min_d = d
 *         if d < min_cusp_bound:             # <<<<<<<<<<<<<<
 *             break
 *     # We have already filtered away identical cusps but as a final stage
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_d, __pyx_v_min_cusp_bound, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 339, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "hilbert_modgroup/pullback_cython.pyx":340
 *             min_d = d
 *         if d < min_cusp_bound:
 *             break             # <<<<<<<<<<<<<<
 *     # We have already filtered away identical cusps but as a final stage
 *     # we also check if the minimal cusps are equal to any of the fixed representatives.
 */
      goto __pyx_L5_break;

      /* "hilbert_modgroup/pullback_cython.pyx":339
 *                 min_cusp = c
 *             min_d = d
 *         if d < min_cusp_bound:             # <<<<<<<<<<<<<<
 *             break
 *     # We have already filtered away identical cusps but as a final stage
 */
    }

    /* "hilbert_modgroup/pullback_cython.pyx":329
 *     # There may be many identical cusps in this list.
 *     # In particular there might be many
 *     for c in cusp_candidates[1:]:             # <<<<<<<<<<<<<<
 *         d = distance_to_cusp(p, c[0],c[1], z)
 *         if abs(d-min_d)<eps and return_multiple:
 */
  }
  __pyx_L5_break:;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":344
 *     # we also check if the minimal cusps are equal to any of the fixed representatives.
 *     # other than infinity which is already taken care of
 *     if p.group().ncusps() == 1:             # <<<<<<<<<<<<<<
 *         return min_cusp
 *     result = []
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_group); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ncusps); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_EqObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_5) {

    /* "hilbert_modgroup/pullback_cython.pyx":345
 *     # other than infinity which is already taken care of
 *     if p.group().ncusps() == 1:
 *         return min_cusp             # <<<<<<<<<<<<<<
 *     result = []
 *     for cusp in p.group().cusps()[1:]:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_min_cusp);
    __pyx_r = __pyx_v_min_cusp;
    goto __pyx_L0;

    /* "hilbert_modgroup/pullback_cython.pyx":344
 *     # we also check if the minimal cusps are equal to any of the fixed representatives.
 *     # other than infinity which is already taken care of
 *     if p.group().ncusps() == 1:             # <<<<<<<<<<<<<<
 *         return min_cusp
 *     result = []
 */
  }

  /* "hilbert_modgroup/pullback_cython.pyx":346
 *     if p.group().ncusps() == 1:
 *         return min_cusp
 *     result = []             # <<<<<<<<<<<<<<
 *     for cusp in p.group().cusps()[1:]:
 *         c, d = cusp.numerator(),cusp.denominator()
 */
  __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_result = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":347
 *         return min_cusp
 *     result = []
 *     for cusp in p.group().cusps()[1:]:             # <<<<<<<<<<<<<<
 *         c, d = cusp.numerator(),cusp.denominator()
 *         quo = c/d
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_group); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cusps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_8 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_8, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_8 = __pyx_t_4; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 347, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_8))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 347, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 347, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_7(__pyx_t_8);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 347, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_cusp, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":348
 *     result = []
 *     for cusp in p.group().cusps()[1:]:
 *         c, d = cusp.numerator(),cusp.denominator()             # <<<<<<<<<<<<<<
 *         quo = c/d
 *         if return_multiple:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cusp, __pyx_n_s_numerator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cusp, __pyx_n_s_denominator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":349
 *     for cusp in p.group().cusps()[1:]:
 *         c, d = cusp.numerator(),cusp.denominator()
 *         quo = c/d             # <<<<<<<<<<<<<<
 *         if return_multiple:
 *             for r,s in min_cusp:
 */
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_c, __pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_quo, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "hilbert_modgroup/pullback_cython.pyx":350
 *         c, d = cusp.numerator(),cusp.denominator()
 *         quo = c/d
 *         if return_multiple:             # <<<<<<<<<<<<<<
 *             for r,s in min_cusp:
 *                 if s == 0:
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_return_multiple); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 350, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "hilbert_modgroup/pullback_cython.pyx":351
 *         quo = c/d
 *         if return_multiple:
 *             for r,s in min_cusp:             # <<<<<<<<<<<<<<
 *                 if s == 0:
 *                     result.append((r, s))
 */
      if (likely(PyList_CheckExact(__pyx_v_min_cusp)) || PyTuple_CheckExact(__pyx_v_min_cusp)) {
        __pyx_t_3 = __pyx_v_min_cusp; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
        __pyx_t_13 = NULL;
      } else {
        __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_min_cusp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 351, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_13)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 351, __pyx_L1_error)
            #else
            __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          } else {
            if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 351, __pyx_L1_error)
            #else
            __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          }
        } else {
          __pyx_t_4 = __pyx_t_13(__pyx_t_3);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 351, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
          PyObject* sequence = __pyx_t_4;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 351, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_11);
          #else
          __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 351, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          #endif
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_14 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 351, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
          index = 0; __pyx_t_1 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_1)) goto __pyx_L18_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_1);
          index = 1; __pyx_t_11 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_11)) goto __pyx_L18_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_11);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 351, __pyx_L1_error)
          __pyx_t_15 = NULL;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          goto __pyx_L19_unpacking_done;
          __pyx_L18_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_15 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 351, __pyx_L1_error)
          __pyx_L19_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "hilbert_modgroup/pullback_cython.pyx":352
 *         if return_multiple:
 *             for r,s in min_cusp:
 *                 if s == 0:             # <<<<<<<<<<<<<<
 *                     result.append((r, s))
 *                 elif r == 0 and (0,1) not in result:
 */
        __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_s, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 352, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_5) {

          /* "hilbert_modgroup/pullback_cython.pyx":353
 *             for r,s in min_cusp:
 *                 if s == 0:
 *                     result.append((r, s))             # <<<<<<<<<<<<<<
 *                 elif r == 0 and (0,1) not in result:
 *                     result.append((0,1))
 */
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_v_r);
          __Pyx_GIVEREF(__pyx_v_r);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_r);
          __Pyx_INCREF(__pyx_v_s);
          __Pyx_GIVEREF(__pyx_v_s);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_s);
          __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 353, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "hilbert_modgroup/pullback_cython.pyx":352
 *         if return_multiple:
 *             for r,s in min_cusp:
 *                 if s == 0:             # <<<<<<<<<<<<<<
 *                     result.append((r, s))
 *                 elif r == 0 and (0,1) not in result:
 */
          goto __pyx_L20;
        }

        /* "hilbert_modgroup/pullback_cython.pyx":354
 *                 if s == 0:
 *                     result.append((r, s))
 *                 elif r == 0 and (0,1) not in result:             # <<<<<<<<<<<<<<
 *                     result.append((0,1))
 *                 elif r == 0:
 */
        __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_r, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 354, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_9) {
        } else {
          __pyx_t_5 = __pyx_t_9;
          goto __pyx_L21_bool_binop_done;
        }
        __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_tuple__4, __pyx_v_result, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 354, __pyx_L1_error)
        __pyx_t_16 = (__pyx_t_9 != 0);
        __pyx_t_5 = __pyx_t_16;
        __pyx_L21_bool_binop_done:;
        if (__pyx_t_5) {

          /* "hilbert_modgroup/pullback_cython.pyx":355
 *                     result.append((r, s))
 *                 elif r == 0 and (0,1) not in result:
 *                     result.append((0,1))             # <<<<<<<<<<<<<<
 *                 elif r == 0:
 *                     continue
 */
          __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_tuple__4); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 355, __pyx_L1_error)

          /* "hilbert_modgroup/pullback_cython.pyx":354
 *                 if s == 0:
 *                     result.append((r, s))
 *                 elif r == 0 and (0,1) not in result:             # <<<<<<<<<<<<<<
 *                     result.append((0,1))
 *                 elif r == 0:
 */
          goto __pyx_L20;
        }

        /* "hilbert_modgroup/pullback_cython.pyx":356
 *                 elif r == 0 and (0,1) not in result:
 *                     result.append((0,1))
 *                 elif r == 0:             # <<<<<<<<<<<<<<
 *                     continue
 *                 elif r/s == quo and (c,d) not in result:
 */
        __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_r, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_5) {

          /* "hilbert_modgroup/pullback_cython.pyx":357
 *                     result.append((0,1))
 *                 elif r == 0:
 *                     continue             # <<<<<<<<<<<<<<
 *                 elif r/s == quo and (c,d) not in result:
 *                     result.append((c,d))
 */
          goto __pyx_L16_continue;

          /* "hilbert_modgroup/pullback_cython.pyx":356
 *                 elif r == 0 and (0,1) not in result:
 *                     result.append((0,1))
 *                 elif r == 0:             # <<<<<<<<<<<<<<
 *                     continue
 *                 elif r/s == quo and (c,d) not in result:
 */
        }

        /* "hilbert_modgroup/pullback_cython.pyx":358
 *                 elif r == 0:
 *                     continue
 *                 elif r/s == quo and (c,d) not in result:             # <<<<<<<<<<<<<<
 *                     result.append((c,d))
 *                 elif r/s != quo:
 */
        __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_r, __pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_11 = PyObject_RichCompare(__pyx_t_4, __pyx_v_quo, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 358, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 358, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (__pyx_t_16) {
        } else {
          __pyx_t_5 = __pyx_t_16;
          goto __pyx_L23_bool_binop_done;
        }
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 358, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_v_c);
        __Pyx_GIVEREF(__pyx_v_c);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_c);
        __Pyx_INCREF(__pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_d);
        __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_t_11, __pyx_v_result, Py_NE)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 358, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_9 = (__pyx_t_16 != 0);
        __pyx_t_5 = __pyx_t_9;
        __pyx_L23_bool_binop_done:;
        if (__pyx_t_5) {

          /* "hilbert_modgroup/pullback_cython.pyx":359
 *                     continue
 *                 elif r/s == quo and (c,d) not in result:
 *                     result.append((c,d))             # <<<<<<<<<<<<<<
 *                 elif r/s != quo:
 *                     result.append((r,s))
 */
          __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 359, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_INCREF(__pyx_v_c);
          __Pyx_GIVEREF(__pyx_v_c);
          PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_c);
          __Pyx_INCREF(__pyx_v_d);
          __Pyx_GIVEREF(__pyx_v_d);
          PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_d);
          __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_t_11); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 359, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

          /* "hilbert_modgroup/pullback_cython.pyx":358
 *                 elif r == 0:
 *                     continue
 *                 elif r/s == quo and (c,d) not in result:             # <<<<<<<<<<<<<<
 *                     result.append((c,d))
 *                 elif r/s != quo:
 */
          goto __pyx_L20;
        }

        /* "hilbert_modgroup/pullback_cython.pyx":360
 *                 elif r/s == quo and (c,d) not in result:
 *                     result.append((c,d))
 *                 elif r/s != quo:             # <<<<<<<<<<<<<<
 *                     result.append((r,s))
 *         elif min_cusp[1] != 0 and min_cusp[0]/min_cusp[1] == quo:
 */
        __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_v_r, __pyx_v_s); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_11, __pyx_v_quo, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 360, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_5) {

          /* "hilbert_modgroup/pullback_cython.pyx":361
 *                     result.append((c,d))
 *                 elif r/s != quo:
 *                     result.append((r,s))             # <<<<<<<<<<<<<<
 *         elif min_cusp[1] != 0 and min_cusp[0]/min_cusp[1] == quo:
 *             result = (c,d)
 */
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_v_r);
          __Pyx_GIVEREF(__pyx_v_r);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_r);
          __Pyx_INCREF(__pyx_v_s);
          __Pyx_GIVEREF(__pyx_v_s);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_s);
          __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 361, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "hilbert_modgroup/pullback_cython.pyx":360
 *                 elif r/s == quo and (c,d) not in result:
 *                     result.append((c,d))
 *                 elif r/s != quo:             # <<<<<<<<<<<<<<
 *                     result.append((r,s))
 *         elif min_cusp[1] != 0 and min_cusp[0]/min_cusp[1] == quo:
 */
        }
        __pyx_L20:;

        /* "hilbert_modgroup/pullback_cython.pyx":351
 *         quo = c/d
 *         if return_multiple:
 *             for r,s in min_cusp:             # <<<<<<<<<<<<<<
 *                 if s == 0:
 *                     result.append((r, s))
 */
        __pyx_L16_continue:;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":350
 *         c, d = cusp.numerator(),cusp.denominator()
 *         quo = c/d
 *         if return_multiple:             # <<<<<<<<<<<<<<
 *             for r,s in min_cusp:
 *                 if s == 0:
 */
      goto __pyx_L15;
    }

    /* "hilbert_modgroup/pullback_cython.pyx":362
 *                 elif r/s != quo:
 *                     result.append((r,s))
 *         elif min_cusp[1] != 0 and min_cusp[0]/min_cusp[1] == quo:             # <<<<<<<<<<<<<<
 *             result = (c,d)
 *         else:
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_min_cusp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_NeObjC(__pyx_t_3, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_9) {
    } else {
      __pyx_t_5 = __pyx_t_9;
      goto __pyx_L25_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_min_cusp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_min_cusp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_11, __pyx_v_quo, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __pyx_t_9;
    __pyx_L25_bool_binop_done:;
    if (__pyx_t_5) {

      /* "hilbert_modgroup/pullback_cython.pyx":363
 *                     result.append((r,s))
 *         elif min_cusp[1] != 0 and min_cusp[0]/min_cusp[1] == quo:
 *             result = (c,d)             # <<<<<<<<<<<<<<
 *         else:
 *             result = min_cusp
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_c);
      __Pyx_GIVEREF(__pyx_v_c);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_c);
      __Pyx_INCREF(__pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_d);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "hilbert_modgroup/pullback_cython.pyx":362
 *                 elif r/s != quo:
 *                     result.append((r,s))
 *         elif min_cusp[1] != 0 and min_cusp[0]/min_cusp[1] == quo:             # <<<<<<<<<<<<<<
 *             result = (c,d)
 *         else:
 */
      goto __pyx_L15;
    }

    /* "hilbert_modgroup/pullback_cython.pyx":365
 *             result = (c,d)
 *         else:
 *             result = min_cusp             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_v_min_cusp);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_v_min_cusp);
    }
    __pyx_L15:;

    /* "hilbert_modgroup/pullback_cython.pyx":347
 *         return min_cusp
 *     result = []
 *     for cusp in p.group().cusps()[1:]:             # <<<<<<<<<<<<<<
 *         c, d = cusp.numerator(),cusp.denominator()
 *         quo = c/d
 */
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":366
 *         else:
 *             result = min_cusp
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cpdef distance_to_cusp(SageObject p, NumberFieldElement r, NumberFieldElement s,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "hilbert_modgroup/pullback_cython.pyx":276
 *     return result
 * 
 * cpdef find_closest_cusp(p, z, return_multiple=False, use_lll=True, use_norm_bound=True):             # <<<<<<<<<<<<<<
 *     r"""
 *     Return the closest cusp(s) to z
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.find_closest_cusp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cusp_candidates);
  __Pyx_XDECREF(__pyx_v_min_cusp);
  __Pyx_XDECREF(__pyx_v_min_d);
  __Pyx_XDECREF(__pyx_v_min_cusp_bound);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_cusp);
  __Pyx_XDECREF(__pyx_v_quo);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_9find_closest_cusp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_16hilbert_modgroup_15pullback_cython_8find_closest_cusp[] = "find_closest_cusp(p, z, return_multiple=False, use_lll=True, use_norm_bound=True)\n\n    Return the closest cusp(s) to z\n    \n    INPUT:\n    - ``p`` -- A HilbertPullback object\n    - ``z`` -- point in the upper half-plane\n    - ``return_multiple`` -- boolean (default False), set to True to return multiple closest cusp if it is no unique. \n    - ``use_lll`` -- boolean (default True) if True uses the LLL method to obtain an initial bound\n    - ``use_norm_bound`` -- boolean (default True) if True uses the norm bound as well as the embedding bounds\n\n    OUTPUT:\n    - tuple representing a cusp (if return_multiple == False)\n    - list of tuples representing cusps (if return_multiple == True) \n    \n    EXAMPLES::\n\n        sage: from hilbert_modgroup.all import *\n        sage: from hilbert_modgroup.pullback_cython import find_closest_cusp\n        sage: H1 = HilbertModularGroup(5)\n        sage: P1 = HilbertPullback(H1)\n        sage: z=UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])\n        sage: find_closest_cusp(P1,z)\n        (1, 0) \n        sage: find_closest_cusp(P1,z,return_multiple=True)\n        [(1, 0), (0, 1)]\n        sage: z=UpperHalfPlaneProductElement([CC(0,0.5),CC(0,1)])\n        sage: find_closest_cusp(P1,z)\n        (0, 1)\n        sage: find_closest_cusp(P1,z,return_multiple=True)\n        [(0, 1)]\n        \n        sage: H2 = HilbertModularGroup(10)\n        sage: P2 = HilbertPullback(H2)\n        sage: z=UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])\n        sage: find_closest_cusp(P2,z)\n        (1, 0)\n        sage: find_closest_cusp(P2,z,return_multiple=True)\n        [(1, 0), (0, 1)]\n        sage: z=UpperHalfPlaneProductElement([CC(-2.58,0.5),CC(0.5,0.5)])\n        sage: find_closest_cusp(P2,z,return_multiple=True)\n        [(-a + 2, -2)]\n        \n    ";
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_9find_closest_cusp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_return_multiple = 0;
  PyObject *__pyx_v_use_lll = 0;
  PyObject *__pyx_v_use_norm_bound = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_closest_cusp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_z,&__pyx_n_s_return_multiple,&__pyx_n_s_use_lll,&__pyx_n_s_use_norm_bound,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_False);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("find_closest_cusp", 0, 2, 5, 1); __PYX_ERR(0, 276, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_multiple);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_lll);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_norm_bound);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_closest_cusp") < 0)) __PYX_ERR(0, 276, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_z = values[1];
    __pyx_v_return_multiple = values[2];
    __pyx_v_use_lll = values[3];
    __pyx_v_use_norm_bound = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find_closest_cusp", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 276, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.find_closest_cusp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_16hilbert_modgroup_15pullback_cython_8find_closest_cusp(__pyx_self, __pyx_v_p, __pyx_v_z, __pyx_v_return_multiple, __pyx_v_use_lll, __pyx_v_use_norm_bound);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_8find_closest_cusp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_z, PyObject *__pyx_v_return_multiple, PyObject *__pyx_v_use_lll, PyObject *__pyx_v_use_norm_bound) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_16hilbert_modgroup_15pullback_cython_find_closest_cusp __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find_closest_cusp", 0);
  __Pyx_TraceCall("find_closest_cusp (wrapper)", __pyx_f[0], 276, 0, __PYX_ERR(0, 276, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.return_multiple = __pyx_v_return_multiple;
  __pyx_t_2.use_lll = __pyx_v_use_lll;
  __pyx_t_2.use_norm_bound = __pyx_v_use_norm_bound;
  __pyx_t_1 = __pyx_f_16hilbert_modgroup_15pullback_cython_find_closest_cusp(__pyx_v_p, __pyx_v_z, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __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("hilbert_modgroup.pullback_cython.find_closest_cusp", __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;
}

/* "hilbert_modgroup/pullback_cython.pyx":368
 *     return result
 * 
 * cpdef distance_to_cusp(SageObject p, NumberFieldElement r, NumberFieldElement s,             # <<<<<<<<<<<<<<
 *                         UpperHalfPlaneProductElement__class z):
 *     r"""
 */

static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_11distance_to_cusp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_16hilbert_modgroup_15pullback_cython_distance_to_cusp(CYTHON_UNUSED struct __pyx_obj_4sage_9structure_11sage_object_SageObject *__pyx_v_p, struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_v_r, struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_v_s, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *__pyx_v_z, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_rlist = 0;
  PyObject *__pyx_v_slist = 0;
  PyObject *__pyx_v_ideal_rs = NULL;
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_v_d = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("distance_to_cusp", 0);
  __Pyx_TraceCall("distance_to_cusp", __pyx_f[0], 368, 0, __PYX_ERR(0, 368, __pyx_L1_error));

  /* "hilbert_modgroup/pullback_cython.pyx":407
 *     """
 *     cdef list rlist,slist
 *     ideal_rs = r.parent().ideal(r,s)             # <<<<<<<<<<<<<<
 *     rlist = r.complex_embeddings()
 *     slist = s.complex_embeddings()
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_r), __pyx_n_s_parent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ideal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_r), ((PyObject *)__pyx_v_s)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_r), ((PyObject *)__pyx_v_s)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_r));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_r));
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, ((PyObject *)__pyx_v_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_s));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_s));
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, ((PyObject *)__pyx_v_s));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ideal_rs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":408
 *     cdef list rlist,slist
 *     ideal_rs = r.parent().ideal(r,s)
 *     rlist = r.complex_embeddings()             # <<<<<<<<<<<<<<
 *     slist = s.complex_embeddings()
 *     n = len(slist)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_r), __pyx_n_s_complex_embeddings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 408, __pyx_L1_error)
  __pyx_v_rlist = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":409
 *     ideal_rs = r.parent().ideal(r,s)
 *     rlist = r.complex_embeddings()
 *     slist = s.complex_embeddings()             # <<<<<<<<<<<<<<
 *     n = len(slist)
 *     d = 1
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_s), __pyx_n_s_complex_embeddings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 409, __pyx_L1_error)
  __pyx_v_slist = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":410
 *     rlist = r.complex_embeddings()
 *     slist = s.complex_embeddings()
 *     n = len(slist)             # <<<<<<<<<<<<<<
 *     d = 1
 *     for i in range(n):
 */
  if (unlikely(__pyx_v_slist == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 410, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_v_slist); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 410, __pyx_L1_error)
  __pyx_v_n = __pyx_t_6;

  /* "hilbert_modgroup/pullback_cython.pyx":411
 *     slist = s.complex_embeddings()
 *     n = len(slist)
 *     d = 1             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         d = d* ((-z._x[i] * slist[i] + rlist[i]) ** 2 * z._y[i] ** -1 + slist[i] ** 2 * z._y[i])
 */
  __Pyx_INCREF(__pyx_int_1);
  __pyx_v_d = __pyx_int_1;

  /* "hilbert_modgroup/pullback_cython.pyx":412
 *     n = len(slist)
 *     d = 1
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         d = d* ((-z._x[i] * slist[i] + rlist[i]) ** 2 * z._y[i] ** -1 + slist[i] ** 2 * z._y[i])
 *     d = ideal_rs.norm()**-1*d.sqrt()
 */
  __pyx_t_6 = __pyx_v_n;
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "hilbert_modgroup/pullback_cython.pyx":413
 *     d = 1
 *     for i in range(n):
 *         d = d* ((-z._x[i] * slist[i] + rlist[i]) ** 2 * z._y[i] ** -1 + slist[i] ** 2 * z._y[i])             # <<<<<<<<<<<<<<
 *     d = ideal_rs.norm()**-1*d.sqrt()
 *     return d
 */
    if (unlikely(__pyx_v_z->__pyx_base._x == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 413, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_z->__pyx_base._x, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(__pyx_v_slist == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 413, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_slist, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(__pyx_v_rlist == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 413, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_rlist, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__pyx_v_z->__pyx_base._y == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 413, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_z->__pyx_base._y, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Power(__pyx_t_3, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_slist == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 413, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_slist, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Power(__pyx_t_4, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_z->__pyx_base._y == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 413, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_z->__pyx_base._y, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_d, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "hilbert_modgroup/pullback_cython.pyx":414
 *     for i in range(n):
 *         d = d* ((-z._x[i] * slist[i] + rlist[i]) ** 2 * z._y[i] ** -1 + slist[i] ** 2 * z._y[i])
 *     d = ideal_rs.norm()**-1*d.sqrt()             # <<<<<<<<<<<<<<
 *     return d
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ideal_rs, __pyx_n_s_norm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Power(__pyx_t_2, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":415
 *         d = d* ((-z._x[i] * slist[i] + rlist[i]) ** 2 * z._y[i] ** -1 + slist[i] ** 2 * z._y[i])
 *     d = ideal_rs.norm()**-1*d.sqrt()
 *     return d             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_d);
  __pyx_r = __pyx_v_d;
  goto __pyx_L0;

  /* "hilbert_modgroup/pullback_cython.pyx":368
 *     return result
 * 
 * cpdef distance_to_cusp(SageObject p, NumberFieldElement r, NumberFieldElement s,             # <<<<<<<<<<<<<<
 *                         UpperHalfPlaneProductElement__class z):
 *     r"""
 */

  /* 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_AddTraceback("hilbert_modgroup.pullback_cython.distance_to_cusp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rlist);
  __Pyx_XDECREF(__pyx_v_slist);
  __Pyx_XDECREF(__pyx_v_ideal_rs);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_11distance_to_cusp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_16hilbert_modgroup_15pullback_cython_10distance_to_cusp[] = "distance_to_cusp(SageObject p, NumberFieldElement r, NumberFieldElement s, UpperHalfPlaneProductElement__class z)\n\n    Return the distance from an element in the upper half-plane to a cusp. \n    \n    INPUT:\n    - ``p`` - Should be an object of type HilbertPullback (but this is not recognized by Cython so I use SageObject instead)\n    - ``r`` - Number field element, numerator of cusp\n    - ``s`` - Number field element, denomnator of cusp\n    - ``z`` - Point in the upper half-plane\n    \n    EXAMPLES::\n    \n        sage: from hilbert_modgroup.all import *\n        sage: from hilbert_modgroup.pullback_cython import distance_to_cusp\n        sage: H1 = HilbertModularGroup(5)\n        sage: P1 = HilbertPullback(H1)\n        sage: K = P1.number_field()\n        sage: z=UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])\n        sage: distance_to_cusp(P1,K(0),K(1),z) # abs tol 1e-10\n        1.0\n        sage: distance_to_cusp(P1,K(1),K(1),z) # abs tol 1e-10\n        2.0\n        sage: z=UpperHalfPlaneProductElement([CC(0,0.5),CC(0,1)])\n        sage: distance_to_cusp(P1,K(0),K(1),z) # abs tol 1e-10\n        0.707106781186548        \n        sage: H2 = HilbertModularGroup(10)\n        sage: P2 = HilbertPullback(H2)\n        sage: K = P2.number_field()\n        sage: z=UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])\n        sage: distance_to_cusp(P2,K(0),K(1),z) # abs tol 1e-10\n        1.0\n        sage: z=UpperHalfPlaneProductElement([CC(-2.58,0.5),CC(0.5,0.5)])\n        sage: a = K.gen()\n        sage: distance_to_cusp(P2,a-5,-a,z) # abs tol 1e-10\n        1.01308408502928\n \n    ";
static PyObject *__pyx_pw_16hilbert_modgroup_15pullback_cython_11distance_to_cusp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4sage_9structure_11sage_object_SageObject *__pyx_v_p = 0;
  struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_v_r = 0;
  struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_v_s = 0;
  struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *__pyx_v_z = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("distance_to_cusp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_r,&__pyx_n_s_s,&__pyx_n_s_z,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("distance_to_cusp", 1, 4, 4, 1); __PYX_ERR(0, 368, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("distance_to_cusp", 1, 4, 4, 2); __PYX_ERR(0, 368, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("distance_to_cusp", 1, 4, 4, 3); __PYX_ERR(0, 368, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "distance_to_cusp") < 0)) __PYX_ERR(0, 368, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_p = ((struct __pyx_obj_4sage_9structure_11sage_object_SageObject *)values[0]);
    __pyx_v_r = ((struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *)values[1]);
    __pyx_v_s = ((struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *)values[2]);
    __pyx_v_z = ((struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("distance_to_cusp", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 368, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("hilbert_modgroup.pullback_cython.distance_to_cusp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_4sage_9structure_11sage_object_SageObject, 1, "p", 0))) __PYX_ERR(0, 368, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_r), __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement, 1, "r", 0))) __PYX_ERR(0, 368, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s), __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement, 1, "s", 0))) __PYX_ERR(0, 368, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class, 1, "z", 0))) __PYX_ERR(0, 369, __pyx_L1_error)
  __pyx_r = __pyx_pf_16hilbert_modgroup_15pullback_cython_10distance_to_cusp(__pyx_self, __pyx_v_p, __pyx_v_r, __pyx_v_s, __pyx_v_z);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_16hilbert_modgroup_15pullback_cython_10distance_to_cusp(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4sage_9structure_11sage_object_SageObject *__pyx_v_p, struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_v_r, struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_v_s, struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class *__pyx_v_z) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("distance_to_cusp", 0);
  __Pyx_TraceCall("distance_to_cusp (wrapper)", __pyx_f[0], 368, 0, __PYX_ERR(0, 368, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_16hilbert_modgroup_15pullback_cython_distance_to_cusp(__pyx_v_p, __pyx_v_r, __pyx_v_s, __pyx_v_z, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __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("hilbert_modgroup.pullback_cython.distance_to_cusp", __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;
}

/* "parent.pxd":23
 *     # Flags, see below
 *     cdef int flags
 *     cdef inline bint get_flag(self, int flag):             # <<<<<<<<<<<<<<
 *         return self.flags & flag
 * 
 */

static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *__pyx_v_self, int __pyx_v_flag) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_flag", 0);
  __Pyx_TraceCall("get_flag", __pyx_f[1], 23, 0, __PYX_ERR(1, 23, __pyx_L1_error));

  /* "parent.pxd":24
 *     cdef int flags
 *     cdef inline bint get_flag(self, int flag):
 *         return self.flags & flag             # <<<<<<<<<<<<<<
 * 
 *     cpdef register_coercion(self, mor)
 */
  __pyx_r = (__pyx_v_self->flags & __pyx_v_flag);
  goto __pyx_L0;

  /* "parent.pxd":23
 *     # Flags, see below
 *     cdef int flags
 *     cdef inline bint get_flag(self, int flag):             # <<<<<<<<<<<<<<
 *         return self.flags & flag
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("sage.structure.parent.Parent.get_flag", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "sage/structure/element.pxd":6
 * 
 * 
 * cpdef inline parent(x):             # <<<<<<<<<<<<<<
 *     """
 *     Return the parent of the element ``x``.
 */

static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent(PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parent", 0);
  __Pyx_TraceCall("parent", __pyx_f[2], 6, 0, __PYX_ERR(2, 6, __pyx_L1_error));

  /* "sage/structure/element.pxd":59
 *         <... 'list'>
 *     """
 *     if isinstance(x, Element):             # <<<<<<<<<<<<<<
 *         return (<Element>x)._parent
 *     return type(x)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, __pyx_ptype_4sage_9structure_7element_Element); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "sage/structure/element.pxd":60
 *     """
 *     if isinstance(x, Element):
 *         return (<Element>x)._parent             # <<<<<<<<<<<<<<
 *     return type(x)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_x)->_parent));
    __pyx_r = ((PyObject *)((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_x)->_parent);
    goto __pyx_L0;

    /* "sage/structure/element.pxd":59
 *         <... 'list'>
 *     """
 *     if isinstance(x, Element):             # <<<<<<<<<<<<<<
 *         return (<Element>x)._parent
 *     return type(x)
 */
  }

  /* "sage/structure/element.pxd":61
 *     if isinstance(x, Element):
 *         return (<Element>x)._parent
 *     return type(x)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_x)));
  __pyx_r = ((PyObject *)Py_TYPE(__pyx_v_x));
  goto __pyx_L0;

  /* "sage/structure/element.pxd":6
 * 
 * 
 * cpdef inline parent(x):             # <<<<<<<<<<<<<<
 *     """
 *     Return the parent of the element ``x``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("sage.structure.element.parent", __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_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4sage_9structure_7element_parent[] = "parent(x)\n\n    Return the parent of the element ``x``.\n\n    Usually, this means the mathematical object of which ``x`` is an\n    element.\n\n    INPUT:\n\n    - ``x`` -- an element\n\n    OUTPUT:\n\n    - If ``x`` is a Sage :class:`Element`, return ``x.parent()``.\n\n    - Otherwise, return ``type(x)``.\n\n    .. SEEALSO::\n\n        `Parents, Conversion and Coercion <http://doc.sagemath.org/html/en/tutorial/tour_coercion.html>`_\n        Section in the Sage Tutorial\n\n    EXAMPLES::\n\n        sage: a = 42\n        sage: parent(a)\n        Integer Ring\n        sage: b = 42/1\n        sage: parent(b)\n        Rational Field\n        sage: c = 42.0\n        sage: parent(c)\n        Real Field with 53 bits of precision\n\n    Some more complicated examples::\n\n        sage: x = Partition([3,2,1,1,1])\n        sage: parent(x)\n        Partitions\n        sage: v = vector(RDF, [1,2,3])\n        sage: parent(v)\n        Vector space of dimension 3 over Real Double Field\n\n    The following are not considered to be elements, so the type is\n    returned::\n\n        sage: d = int(42)  # Python int\n        sage: parent(d)\n        <... 'int'>\n        sage: L = list(range(10))\n        sage: parent(L)\n        <... 'list'>\n    ";
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parent (wrapper)", 0);
  __pyx_r = __pyx_pf_4sage_9structure_7element_parent(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4sage_9structure_7element_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parent", 0);
  __Pyx_TraceCall("parent (wrapper)", __pyx_f[2], 6, 0, __PYX_ERR(2, 6, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4sage_9structure_7element_parent(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __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("sage.structure.element.parent", __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;
}

/* "sage/structure/element.pxd":64
 * 
 * 
 * cdef inline int classify_elements(left, right):             # <<<<<<<<<<<<<<
 *     """
 *     Given two objects, at least one which is an :class:`Element`,
 */

static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_classify_elements(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("classify_elements", 0);
  __Pyx_TraceCall("classify_elements", __pyx_f[2], 64, 0, __PYX_ERR(2, 64, __pyx_L1_error));

  /* "sage/structure/element.pxd":87
 *     - 0o37: both are Element, same type, same parent
 *     """
 *     if type(left) is type(right):             # <<<<<<<<<<<<<<
 *         # We know at least one of the arguments is an Element. So if
 *         # their types are *equal* (fast to check) then they are both
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_left)) == ((PyObject *)Py_TYPE(__pyx_v_right)));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "sage/structure/element.pxd":91
 *         # their types are *equal* (fast to check) then they are both
 *         # Elements.
 *         if (<Element>left)._parent is (<Element>right)._parent:             # <<<<<<<<<<<<<<
 *             return 0o37
 *         else:
 */
    __pyx_t_2 = (((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_left)->_parent == ((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_right)->_parent);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "sage/structure/element.pxd":92
 *         # Elements.
 *         if (<Element>left)._parent is (<Element>right)._parent:
 *             return 0o37             # <<<<<<<<<<<<<<
 *         else:
 *             return 0o17
 */
      __pyx_r = 037;
      goto __pyx_L0;

      /* "sage/structure/element.pxd":91
 *         # their types are *equal* (fast to check) then they are both
 *         # Elements.
 *         if (<Element>left)._parent is (<Element>right)._parent:             # <<<<<<<<<<<<<<
 *             return 0o37
 *         else:
 */
    }

    /* "sage/structure/element.pxd":94
 *             return 0o37
 *         else:
 *             return 0o17             # <<<<<<<<<<<<<<
 *     if not isinstance(right, Element):
 *         return 0o01
 */
    /*else*/ {
      __pyx_r = 017;
      goto __pyx_L0;
    }

    /* "sage/structure/element.pxd":87
 *     - 0o37: both are Element, same type, same parent
 *     """
 *     if type(left) is type(right):             # <<<<<<<<<<<<<<
 *         # We know at least one of the arguments is an Element. So if
 *         # their types are *equal* (fast to check) then they are both
 */
  }

  /* "sage/structure/element.pxd":95
 *         else:
 *             return 0o17
 *     if not isinstance(right, Element):             # <<<<<<<<<<<<<<
 *         return 0o01
 *     if not isinstance(left, Element):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_right, __pyx_ptype_4sage_9structure_7element_Element); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "sage/structure/element.pxd":96
 *             return 0o17
 *     if not isinstance(right, Element):
 *         return 0o01             # <<<<<<<<<<<<<<
 *     if not isinstance(left, Element):
 *         return 0o02
 */
    __pyx_r = 001;
    goto __pyx_L0;

    /* "sage/structure/element.pxd":95
 *         else:
 *             return 0o17
 *     if not isinstance(right, Element):             # <<<<<<<<<<<<<<
 *         return 0o01
 *     if not isinstance(left, Element):
 */
  }

  /* "sage/structure/element.pxd":97
 *     if not isinstance(right, Element):
 *         return 0o01
 *     if not isinstance(left, Element):             # <<<<<<<<<<<<<<
 *         return 0o02
 *     if (<Element>left)._parent is (<Element>right)._parent:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_left, __pyx_ptype_4sage_9structure_7element_Element); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_1) {

    /* "sage/structure/element.pxd":98
 *         return 0o01
 *     if not isinstance(left, Element):
 *         return 0o02             # <<<<<<<<<<<<<<
 *     if (<Element>left)._parent is (<Element>right)._parent:
 *         return 0o27
 */
    __pyx_r = 002;
    goto __pyx_L0;

    /* "sage/structure/element.pxd":97
 *     if not isinstance(right, Element):
 *         return 0o01
 *     if not isinstance(left, Element):             # <<<<<<<<<<<<<<
 *         return 0o02
 *     if (<Element>left)._parent is (<Element>right)._parent:
 */
  }

  /* "sage/structure/element.pxd":99
 *     if not isinstance(left, Element):
 *         return 0o02
 *     if (<Element>left)._parent is (<Element>right)._parent:             # <<<<<<<<<<<<<<
 *         return 0o27
 *     else:
 */
  __pyx_t_1 = (((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_left)->_parent == ((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_right)->_parent);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "sage/structure/element.pxd":100
 *         return 0o02
 *     if (<Element>left)._parent is (<Element>right)._parent:
 *         return 0o27             # <<<<<<<<<<<<<<
 *     else:
 *         return 0o07
 */
    __pyx_r = 027;
    goto __pyx_L0;

    /* "sage/structure/element.pxd":99
 *     if not isinstance(left, Element):
 *         return 0o02
 *     if (<Element>left)._parent is (<Element>right)._parent:             # <<<<<<<<<<<<<<
 *         return 0o27
 *     else:
 */
  }

  /* "sage/structure/element.pxd":102
 *         return 0o27
 *     else:
 *         return 0o07             # <<<<<<<<<<<<<<
 * 
 * # Functions to help understand the result of classify_elements()
 */
  /*else*/ {
    __pyx_r = 007;
    goto __pyx_L0;
  }

  /* "sage/structure/element.pxd":64
 * 
 * 
 * cdef inline int classify_elements(left, right):             # <<<<<<<<<<<<<<
 *     """
 *     Given two objects, at least one which is an :class:`Element`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("sage.structure.element.classify_elements", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "sage/structure/element.pxd":105
 * 
 * # Functions to help understand the result of classify_elements()
 * cdef inline bint BOTH_ARE_ELEMENT(int cl):             # <<<<<<<<<<<<<<
 *     return cl & 0o04
 * cdef inline bint HAVE_SAME_PARENT(int cl):
 */

static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_BOTH_ARE_ELEMENT(int __pyx_v_cl) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("BOTH_ARE_ELEMENT", 0);
  __Pyx_TraceCall("BOTH_ARE_ELEMENT", __pyx_f[2], 105, 0, __PYX_ERR(2, 105, __pyx_L1_error));

  /* "sage/structure/element.pxd":106
 * # Functions to help understand the result of classify_elements()
 * cdef inline bint BOTH_ARE_ELEMENT(int cl):
 *     return cl & 0o04             # <<<<<<<<<<<<<<
 * cdef inline bint HAVE_SAME_PARENT(int cl):
 *     return cl & 0o20
 */
  __pyx_r = (__pyx_v_cl & 004);
  goto __pyx_L0;

  /* "sage/structure/element.pxd":105
 * 
 * # Functions to help understand the result of classify_elements()
 * cdef inline bint BOTH_ARE_ELEMENT(int cl):             # <<<<<<<<<<<<<<
 *     return cl & 0o04
 * cdef inline bint HAVE_SAME_PARENT(int cl):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("sage.structure.element.BOTH_ARE_ELEMENT", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "sage/structure/element.pxd":107
 * cdef inline bint BOTH_ARE_ELEMENT(int cl):
 *     return cl & 0o04
 * cdef inline bint HAVE_SAME_PARENT(int cl):             # <<<<<<<<<<<<<<
 *     return cl & 0o20
 * 
 */

static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(int __pyx_v_cl) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("HAVE_SAME_PARENT", 0);
  __Pyx_TraceCall("HAVE_SAME_PARENT", __pyx_f[2], 107, 0, __PYX_ERR(2, 107, __pyx_L1_error));

  /* "sage/structure/element.pxd":108
 *     return cl & 0o04
 * cdef inline bint HAVE_SAME_PARENT(int cl):
 *     return cl & 0o20             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = (__pyx_v_cl & 020);
  goto __pyx_L0;

  /* "sage/structure/element.pxd":107
 * cdef inline bint BOTH_ARE_ELEMENT(int cl):
 *     return cl & 0o04
 * cdef inline bint HAVE_SAME_PARENT(int cl):             # <<<<<<<<<<<<<<
 *     return cl & 0o20
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("sage.structure.element.HAVE_SAME_PARENT", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "sage/structure/element.pxd":111
 * 
 * 
 * cpdef inline bint have_same_parent(left, right):             # <<<<<<<<<<<<<<
 *     """
 *     Return ``True`` if and only if ``left`` and ``right`` have the
 */

static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_have_same_parent(PyObject *__pyx_v_left, PyObject *__pyx_v_right, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("have_same_parent", 0);
  __Pyx_TraceCall("have_same_parent", __pyx_f[2], 111, 0, __PYX_ERR(2, 111, __pyx_L1_error));

  /* "sage/structure/element.pxd":143
 *         True
 *     """
 *     return HAVE_SAME_PARENT(classify_elements(left, right))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(__pyx_f_4sage_9structure_7element_classify_elements(__pyx_v_left, __pyx_v_right));
  goto __pyx_L0;

  /* "sage/structure/element.pxd":111
 * 
 * 
 * cpdef inline bint have_same_parent(left, right):             # <<<<<<<<<<<<<<
 *     """
 *     Return ``True`` if and only if ``left`` and ``right`` have the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("sage.structure.element.have_same_parent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4sage_9structure_7element_2have_same_parent[] = "have_same_parent(left, right) -> bool\n\n    Return ``True`` if and only if ``left`` and ``right`` have the\n    same parent.\n\n    .. WARNING::\n\n        This function assumes that at least one of the arguments is a\n        Sage :class:`Element`. When in doubt, use the slower\n        ``parent(left) is parent(right)`` instead.\n\n    EXAMPLES::\n\n        sage: from sage.structure.element import have_same_parent\n        sage: have_same_parent(1, 3)\n        True\n        sage: have_same_parent(1, 1/2)\n        False\n        sage: have_same_parent(gap(1), gap(1/2))\n        True\n\n    These have different types but the same parent::\n\n        sage: a = RLF(2)\n        sage: b = exp(a)\n        sage: type(a)\n        <... 'sage.rings.real_lazy.LazyWrapper'>\n        sage: type(b)\n        <... 'sage.rings.real_lazy.LazyNamedUnop'>\n        sage: have_same_parent(a, b)\n        True\n    ";
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_left = 0;
  PyObject *__pyx_v_right = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("have_same_parent (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left,&__pyx_n_s_right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("have_same_parent", 1, 2, 2, 1); __PYX_ERR(2, 111, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "have_same_parent") < 0)) __PYX_ERR(2, 111, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = values[0];
    __pyx_v_right = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("have_same_parent", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 111, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("sage.structure.element.have_same_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4sage_9structure_7element_2have_same_parent(__pyx_self, __pyx_v_left, __pyx_v_right);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4sage_9structure_7element_2have_same_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("have_same_parent", 0);
  __Pyx_TraceCall("have_same_parent (wrapper)", __pyx_f[2], 111, 0, __PYX_ERR(2, 111, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4sage_9structure_7element_have_same_parent(__pyx_v_left, __pyx_v_right, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 111, __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("sage.structure.element.have_same_parent", __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;
}

/* "sage/rings/real_mpfr.pxd":15
 *     cdef mpfr_rnd_t rnd
 *     cdef object rnd_str
 *     cdef inline RealNumber _new(self):             # <<<<<<<<<<<<<<
 *         """Return a new real number with parent ``self``."""
 *         return <RealNumber>(RealNumber.__new__(RealNumber, self))
 */

static CYTHON_INLINE struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_f_4sage_5rings_9real_mpfr_15RealField_class__new(struct __pyx_obj_4sage_5rings_9real_mpfr_RealField_class *__pyx_v_self) {
  struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_new", 0);
  __Pyx_TraceCall("_new", __pyx_f[3], 15, 0, __PYX_ERR(3, 15, __pyx_L1_error));

  /* "sage/rings/real_mpfr.pxd":17
 *     cdef inline RealNumber _new(self):
 *         """Return a new real number with parent ``self``."""
 *         return <RealNumber>(RealNumber.__new__(RealNumber, self))             # <<<<<<<<<<<<<<
 * 
 * cdef class RealNumber(sage.structure.element.RingElement):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_tp_new(((PyObject *)__pyx_ptype_4sage_5rings_9real_mpfr_RealNumber), ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *)__pyx_t_2)));
  __pyx_r = ((struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "sage/rings/real_mpfr.pxd":15
 *     cdef mpfr_rnd_t rnd
 *     cdef object rnd_str
 *     cdef inline RealNumber _new(self):             # <<<<<<<<<<<<<<
 *         """Return a new real number with parent ``self``."""
 *         return <RealNumber>(RealNumber.__new__(RealNumber, self))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("sage.rings.real_mpfr.RealField_class._new", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "sage/rings/real_mpfr.pxd":21
 * cdef class RealNumber(sage.structure.element.RingElement):
 *     cdef mpfr_t value
 *     cdef inline RealNumber _new(self):             # <<<<<<<<<<<<<<
 *         """Return a new real number with same parent as ``self``."""
 *         return <RealNumber>(RealNumber.__new__(RealNumber, self._parent))
 */

static CYTHON_INLINE struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_f_4sage_5rings_9real_mpfr_10RealNumber__new(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_v_self) {
  struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_new", 0);
  __Pyx_TraceCall("_new", __pyx_f[3], 21, 0, __PYX_ERR(3, 21, __pyx_L1_error));

  /* "sage/rings/real_mpfr.pxd":23
 *     cdef inline RealNumber _new(self):
 *         """Return a new real number with same parent as ``self``."""
 *         return <RealNumber>(RealNumber.__new__(RealNumber, self._parent))             # <<<<<<<<<<<<<<
 *     cpdef _add_(self, other)
 *     cpdef _mul_(self, other)
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._parent));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._parent));
  __pyx_t_2 = __Pyx_tp_new(((PyObject *)__pyx_ptype_4sage_5rings_9real_mpfr_RealNumber), ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *)__pyx_t_2)));
  __pyx_r = ((struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "sage/rings/real_mpfr.pxd":21
 * cdef class RealNumber(sage.structure.element.RingElement):
 *     cdef mpfr_t value
 *     cdef inline RealNumber _new(self):             # <<<<<<<<<<<<<<
 *         """Return a new real number with same parent as ``self``."""
 *         return <RealNumber>(RealNumber.__new__(RealNumber, self._parent))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("sage.rings.real_mpfr.RealNumber._new", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "sage/rings/integer.pxd":40
 * cdef Integer smallInteger(long value)
 * 
 * cdef inline Integer _Integer_from_mpz(mpz_t e):             # <<<<<<<<<<<<<<
 *     cdef Integer z = Integer.__new__(Integer)
 *     mpz_set(z.value, e)
 */

static CYTHON_INLINE struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_f_4sage_5rings_7integer__Integer_from_mpz(__mpz_struct *__pyx_v_e) {
  struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_z = 0;
  struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_Integer_from_mpz", 0);
  __Pyx_TraceCall("_Integer_from_mpz", __pyx_f[4], 40, 0, __PYX_ERR(4, 40, __pyx_L1_error));

  /* "sage/rings/integer.pxd":41
 * 
 * cdef inline Integer _Integer_from_mpz(mpz_t e):
 *     cdef Integer z = Integer.__new__(Integer)             # <<<<<<<<<<<<<<
 *     mpz_set(z.value, e)
 *     return z
 */
  __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4sage_5rings_7integer_Integer)))) __PYX_ERR(4, 41, __pyx_L1_error)
  __pyx_v_z = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "sage/rings/integer.pxd":42
 * cdef inline Integer _Integer_from_mpz(mpz_t e):
 *     cdef Integer z = Integer.__new__(Integer)
 *     mpz_set(z.value, e)             # <<<<<<<<<<<<<<
 *     return z
 * 
 */
  mpz_set(__pyx_v_z->value, __pyx_v_e);

  /* "sage/rings/integer.pxd":43
 *     cdef Integer z = Integer.__new__(Integer)
 *     mpz_set(z.value, e)
 *     return z             # <<<<<<<<<<<<<<
 * 
 * cdef class int_to_Z(Morphism):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_z));
  __pyx_r = __pyx_v_z;
  goto __pyx_L0;

  /* "sage/rings/integer.pxd":40
 * cdef Integer smallInteger(long value)
 * 
 * cdef inline Integer _Integer_from_mpz(mpz_t e):             # <<<<<<<<<<<<<<
 *     cdef Integer z = Integer.__new__(Integer)
 *     mpz_set(z.value, e)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("sage.rings.integer._Integer_from_mpz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_z);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyMethodDef __pyx_methods[] = {
  {"integral_coordinates_in_box", (PyCFunction)__pyx_pw_16hilbert_modgroup_15pullback_cython_1integral_coordinates_in_box, METH_O, __pyx_doc_16hilbert_modgroup_15pullback_cython_integral_coordinates_in_box},
  {"lattice_elements_in_box", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_16hilbert_modgroup_15pullback_cython_3lattice_elements_in_box, METH_VARARGS|METH_KEYWORDS, __pyx_doc_16hilbert_modgroup_15pullback_cython_2lattice_elements_in_box},
  {"coordinates_to_ideal_elements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_16hilbert_modgroup_15pullback_cython_5coordinates_to_ideal_elements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_16hilbert_modgroup_15pullback_cython_4coordinates_to_ideal_elements},
  {"find_candidate_cusps", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_16hilbert_modgroup_15pullback_cython_7find_candidate_cusps, METH_VARARGS|METH_KEYWORDS, __pyx_doc_16hilbert_modgroup_15pullback_cython_6find_candidate_cusps},
  {"find_closest_cusp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_16hilbert_modgroup_15pullback_cython_9find_closest_cusp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_16hilbert_modgroup_15pullback_cython_8find_closest_cusp},
  {"distance_to_cusp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_16hilbert_modgroup_15pullback_cython_11distance_to_cusp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_16hilbert_modgroup_15pullback_cython_10distance_to_cusp},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_pullback_cython(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_pullback_cython},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "pullback_cython",
    __pyx_k_Cython_versions_of_Pullback_alg, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_Bounds_must_give_interval_of_pos, __pyx_k_Bounds_must_give_interval_of_pos, sizeof(__pyx_k_Bounds_must_give_interval_of_pos), 0, 1, 0, 0},
  {&__pyx_kp_u_Coordinate_need_to_have_same_len, __pyx_k_Coordinate_need_to_have_same_len, sizeof(__pyx_k_Coordinate_need_to_have_same_len), 0, 1, 0, 0},
  {&__pyx_n_s_Infinity, __pyx_k_Infinity, sizeof(__pyx_k_Infinity), 0, 0, 1, 1},
  {&__pyx_n_s_Matrix, __pyx_k_Matrix, sizeof(__pyx_k_Matrix), 0, 0, 1, 1},
  {&__pyx_n_s_NFCusp, __pyx_k_NFCusp, sizeof(__pyx_k_NFCusp), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_basis_matrix_ideal, __pyx_k_basis_matrix_ideal, sizeof(__pyx_k_basis_matrix_ideal), 0, 0, 1, 1},
  {&__pyx_n_s_bound_for_closest_cusp, __pyx_k_bound_for_closest_cusp, sizeof(__pyx_k_bound_for_closest_cusp), 0, 0, 1, 1},
  {&__pyx_n_s_bound_for_rho_coordinates, __pyx_k_bound_for_rho_coordinates, sizeof(__pyx_k_bound_for_rho_coordinates), 0, 0, 1, 1},
  {&__pyx_n_s_bound_for_rho_embeddings, __pyx_k_bound_for_rho_embeddings, sizeof(__pyx_k_bound_for_rho_embeddings), 0, 0, 1, 1},
  {&__pyx_n_s_bound_for_sigma_coordinates, __pyx_k_bound_for_sigma_coordinates, sizeof(__pyx_k_bound_for_sigma_coordinates), 0, 0, 1, 1},
  {&__pyx_n_s_bound_for_sigma_embeddings, __pyx_k_bound_for_sigma_embeddings, sizeof(__pyx_k_bound_for_sigma_embeddings), 0, 0, 1, 1},
  {&__pyx_n_s_bound_for_sigma_norm, __pyx_k_bound_for_sigma_norm, sizeof(__pyx_k_bound_for_sigma_norm), 0, 0, 1, 1},
  {&__pyx_n_s_cartesian_product, __pyx_k_cartesian_product, sizeof(__pyx_k_cartesian_product), 0, 0, 1, 1},
  {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_complex_embeddings, __pyx_k_complex_embeddings, sizeof(__pyx_k_complex_embeddings), 0, 0, 1, 1},
  {&__pyx_n_s_construct_ideal, __pyx_k_construct_ideal, sizeof(__pyx_k_construct_ideal), 0, 0, 1, 1},
  {&__pyx_n_s_coordinate_bounds, __pyx_k_coordinate_bounds, sizeof(__pyx_k_coordinate_bounds), 0, 0, 1, 1},
  {&__pyx_n_s_coordinates, __pyx_k_coordinates, sizeof(__pyx_k_coordinates), 0, 0, 1, 1},
  {&__pyx_n_s_cusps, __pyx_k_cusps, sizeof(__pyx_k_cusps), 0, 0, 1, 1},
  {&__pyx_n_s_denominator, __pyx_k_denominator, sizeof(__pyx_k_denominator), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_floor, __pyx_k_floor, sizeof(__pyx_k_floor), 0, 0, 1, 1},
  {&__pyx_n_s_gcd, __pyx_k_gcd, sizeof(__pyx_k_gcd), 0, 0, 1, 1},
  {&__pyx_n_s_get_heuristic_closest_cusp, __pyx_k_get_heuristic_closest_cusp, sizeof(__pyx_k_get_heuristic_closest_cusp), 0, 0, 1, 1},
  {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
  {&__pyx_n_s_ideal, __pyx_k_ideal, sizeof(__pyx_k_ideal), 0, 0, 1, 1},
  {&__pyx_n_s_ideal_basis, __pyx_k_ideal_basis, sizeof(__pyx_k_ideal_basis), 0, 0, 1, 1},
  {&__pyx_n_s_identity_matrix, __pyx_k_identity_matrix, sizeof(__pyx_k_identity_matrix), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_initial_bd_d, __pyx_k_initial_bd_d, sizeof(__pyx_k_initial_bd_d), 0, 0, 1, 1},
  {&__pyx_n_s_integral_basis, __pyx_k_integral_basis, sizeof(__pyx_k_integral_basis), 0, 0, 1, 1},
  {&__pyx_n_s_is_NumberFieldElement, __pyx_k_is_NumberFieldElement, sizeof(__pyx_k_is_NumberFieldElement), 0, 0, 1, 1},
  {&__pyx_n_s_lattice_basis, __pyx_k_lattice_basis, sizeof(__pyx_k_lattice_basis), 0, 0, 1, 1},
  {&__pyx_n_s_lattice_bounds, __pyx_k_lattice_bounds, sizeof(__pyx_k_lattice_bounds), 0, 0, 1, 1},
  {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_ncusps, __pyx_k_ncusps, sizeof(__pyx_k_ncusps), 0, 0, 1, 1},
  {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1},
  {&__pyx_n_s_norm_bound, __pyx_k_norm_bound, sizeof(__pyx_k_norm_bound), 0, 0, 1, 1},
  {&__pyx_n_s_number_field, __pyx_k_number_field, sizeof(__pyx_k_number_field), 0, 0, 1, 1},
  {&__pyx_n_s_numerator, __pyx_k_numerator, sizeof(__pyx_k_numerator), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
  {&__pyx_n_s_prec, __pyx_k_prec, sizeof(__pyx_k_prec), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  {&__pyx_n_s_return_multiple, __pyx_k_return_multiple, sizeof(__pyx_k_return_multiple), 0, 0, 1, 1},
  {&__pyx_n_s_return_sigma_candidates, __pyx_k_return_sigma_candidates, sizeof(__pyx_k_return_sigma_candidates), 0, 0, 1, 1},
  {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1},
  {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  {&__pyx_n_s_sage_all, __pyx_k_sage_all, sizeof(__pyx_k_sage_all), 0, 0, 1, 1},
  {&__pyx_n_s_sage_arith_misc, __pyx_k_sage_arith_misc, sizeof(__pyx_k_sage_arith_misc), 0, 0, 1, 1},
  {&__pyx_n_s_sage_matrix_all, __pyx_k_sage_matrix_all, sizeof(__pyx_k_sage_matrix_all), 0, 0, 1, 1},
  {&__pyx_n_s_sage_matrix_constructor, __pyx_k_sage_matrix_constructor, sizeof(__pyx_k_sage_matrix_constructor), 0, 0, 1, 1},
  {&__pyx_n_s_sage_modular_cusps_nf, __pyx_k_sage_modular_cusps_nf, sizeof(__pyx_k_sage_modular_cusps_nf), 0, 0, 1, 1},
  {&__pyx_n_s_sage_rings_infinity, __pyx_k_sage_rings_infinity, sizeof(__pyx_k_sage_rings_infinity), 0, 0, 1, 1},
  {&__pyx_n_s_sage_rings_number_field_number_f, __pyx_k_sage_rings_number_field_number_f, sizeof(__pyx_k_sage_rings_number_field_number_f), 0, 0, 1, 1},
  {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_use_initial_bd_d, __pyx_k_use_initial_bd_d, sizeof(__pyx_k_use_initial_bd_d), 0, 0, 1, 1},
  {&__pyx_n_s_use_lll, __pyx_k_use_lll, sizeof(__pyx_k_use_lll), 0, 0, 1, 1},
  {&__pyx_n_s_use_norm_bound, __pyx_k_use_norm_bound, sizeof(__pyx_k_use_norm_bound), 0, 0, 1, 1},
  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 55, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 58, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 150, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "hilbert_modgroup/pullback_cython.pyx":62
 *         upper = floor(bounds[i][1])
 *         if lower > upper:
 *             raise ValueError("Bounds must give interval of positive length.")             # <<<<<<<<<<<<<<
 *         coordinates.append(range(lower, upper + 1))
 *     # result = [tuple(x) for x in cartesian_product(coordinates)]
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Bounds_must_give_interval_of_pos); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "hilbert_modgroup/pullback_cython.pyx":148
 *     for coordinate_vector in coordinates:
 *         if len(coordinate_vector) != n:
 *             raise ValueError("Coordinate need to have same length as basis!")             # <<<<<<<<<<<<<<
 *         element = 0
 *         for i,b in enumerate(ideal_basis):
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Coordinate_need_to_have_same_len); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "hilbert_modgroup/pullback_cython.pyx":329
 *     # There may be many identical cusps in this list.
 *     # In particular there might be many
 *     for c in cusp_candidates[1:]:             # <<<<<<<<<<<<<<
 *         d = distance_to_cusp(p, c[0],c[1], z)
 *         if abs(d-min_d)<eps and return_multiple:
 */
  __pyx_slice__3 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__3);
  __Pyx_GIVEREF(__pyx_slice__3);

  /* "hilbert_modgroup/pullback_cython.pyx":354
 *                 if s == 0:
 *                     result.append((r, s))
 *                 elif r == 0 and (0,1) not in result:             # <<<<<<<<<<<<<<
 *                     result.append((0,1))
 *                 elif r == 0:
 */
  __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyList_Type_remove.type = (PyObject*)&PyList_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("sage.structure.sage_object"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_9structure_11sage_object_SageObject = __Pyx_ImportType(__pyx_t_1, "sage.structure.sage_object", "SageObject", sizeof(struct __pyx_obj_4sage_9structure_11sage_object_SageObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_11sage_object_SageObject) __PYX_ERR(5, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.structure.category_object"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_9structure_15category_object_CategoryObject = __Pyx_ImportType(__pyx_t_1, "sage.structure.category_object", "CategoryObject", sizeof(struct __pyx_obj_4sage_9structure_15category_object_CategoryObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_15category_object_CategoryObject) __PYX_ERR(6, 15, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_15category_object_CategoryObject = (struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_15category_object_CategoryObject->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject)) __PYX_ERR(6, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(7, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.structure.coerce_dict"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_9structure_11coerce_dict_MonoDict = __Pyx_ImportType(__pyx_t_1, "sage.structure.coerce_dict", "MonoDict", sizeof(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict = (struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict)) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_11coerce_dict_TripleDict = __Pyx_ImportType(__pyx_t_1, "sage.structure.coerce_dict", "TripleDict", sizeof(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict) __PYX_ERR(8, 38, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict = (struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict)) __PYX_ERR(8, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.misc.inherit_comparison"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass = __Pyx_ImportType(__pyx_t_1, "sage.misc.inherit_comparison", "InheritComparisonMetaclass", sizeof(struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass) __PYX_ERR(9, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.structure.parent_old"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_9structure_10parent_old_Parent = __Pyx_ImportType(__pyx_t_1, "sage.structure.parent_old", "Parent", sizeof(struct __pyx_obj_4sage_9structure_10parent_old_Parent), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_10parent_old_Parent) __PYX_ERR(10, 15, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_10parent_old_Parent = (struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_10parent_old_Parent->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_10parent_old_Parent)) __PYX_ERR(10, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.structure.parent_base"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_9structure_11parent_base_ParentWithBase = __Pyx_ImportType(__pyx_t_1, "sage.structure.parent_base", "ParentWithBase", sizeof(struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_11parent_base_ParentWithBase) __PYX_ERR(11, 11, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_11parent_base_ParentWithBase = (struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11parent_base_ParentWithBase->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11parent_base_ParentWithBase)) __PYX_ERR(11, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.structure.parent_gens"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens = __Pyx_ImportType(__pyx_t_1, "sage.structure.parent_gens", "ParentWithGens", sizeof(struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens) __PYX_ERR(12, 18, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_11parent_gens_ParentWithGens = (struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11parent_gens_ParentWithGens)) __PYX_ERR(12, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.rings.ring"); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_5rings_4ring_Ring = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "Ring", sizeof(struct __pyx_obj_4sage_5rings_4ring_Ring), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_Ring) __PYX_ERR(13, 5, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_Ring = (struct __pyx_vtabstruct_4sage_5rings_4ring_Ring*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_Ring->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_Ring)) __PYX_ERR(13, 5, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_4ring_CommutativeRing = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "CommutativeRing", sizeof(struct __pyx_obj_4sage_5rings_4ring_CommutativeRing), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_CommutativeRing) __PYX_ERR(13, 13, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_CommutativeRing = (struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_CommutativeRing->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_CommutativeRing)) __PYX_ERR(13, 13, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_4ring_IntegralDomain = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "IntegralDomain", sizeof(struct __pyx_obj_4sage_5rings_4ring_IntegralDomain), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_IntegralDomain) __PYX_ERR(13, 16, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_IntegralDomain = (struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_IntegralDomain->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_IntegralDomain)) __PYX_ERR(13, 16, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_4ring_DedekindDomain = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "DedekindDomain", sizeof(struct __pyx_obj_4sage_5rings_4ring_DedekindDomain), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_DedekindDomain) __PYX_ERR(13, 19, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_DedekindDomain = (struct __pyx_vtabstruct_4sage_5rings_4ring_DedekindDomain*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_DedekindDomain->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_DedekindDomain)) __PYX_ERR(13, 19, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "PrincipalIdealDomain", sizeof(struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain) __PYX_ERR(13, 23, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_PrincipalIdealDomain = (struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_PrincipalIdealDomain)) __PYX_ERR(13, 23, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_4ring_EuclideanDomain = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "EuclideanDomain", sizeof(struct __pyx_obj_4sage_5rings_4ring_EuclideanDomain), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_EuclideanDomain) __PYX_ERR(13, 26, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_EuclideanDomain = (struct __pyx_vtabstruct_4sage_5rings_4ring_EuclideanDomain*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_EuclideanDomain->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_EuclideanDomain)) __PYX_ERR(13, 26, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_4ring_Field = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "Field", sizeof(struct __pyx_obj_4sage_5rings_4ring_Field), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_Field) __PYX_ERR(13, 29, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_Field = (struct __pyx_vtabstruct_4sage_5rings_4ring_Field*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_Field->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_Field)) __PYX_ERR(13, 29, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_4ring_Algebra = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "Algebra", sizeof(struct __pyx_obj_4sage_5rings_4ring_Algebra), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_Algebra) __PYX_ERR(13, 32, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_Algebra = (struct __pyx_vtabstruct_4sage_5rings_4ring_Algebra*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_Algebra->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_Algebra)) __PYX_ERR(13, 32, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra = __Pyx_ImportType(__pyx_t_1, "sage.rings.ring", "CommutativeAlgebra", sizeof(struct __pyx_obj_4sage_5rings_4ring_CommutativeAlgebra), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra) __PYX_ERR(13, 35, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_4ring_CommutativeAlgebra = (struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeAlgebra*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_CommutativeAlgebra)) __PYX_ERR(13, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.structure.parent"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_9structure_6parent_Parent = __Pyx_ImportType(__pyx_t_1, "sage.structure.parent", "Parent", sizeof(struct __pyx_obj_4sage_9structure_6parent_Parent), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_6parent_Parent) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_6parent_Parent = (struct __pyx_vtabstruct_4sage_9structure_6parent_Parent*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_6parent_Parent->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_6parent_Parent)) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_6parent_Set_generic = __Pyx_ImportType(__pyx_t_1, "sage.structure.parent", "Set_generic", sizeof(struct __pyx_obj_4sage_9structure_6parent_Set_generic), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_6parent_Set_generic) __PYX_ERR(1, 103, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_6parent_Set_generic = (struct __pyx_vtabstruct_4sage_9structure_6parent_Set_generic*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_6parent_Set_generic->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_6parent_Set_generic)) __PYX_ERR(1, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.structure.element"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_9structure_7element_Element = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "Element", sizeof(struct __pyx_obj_4sage_9structure_7element_Element), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_Element) __PYX_ERR(2, 150, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_Element = (struct __pyx_vtabstruct_4sage_9structure_7element_Element*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Element->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Element)) __PYX_ERR(2, 150, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "ElementWithCachedMethod", sizeof(struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod) __PYX_ERR(2, 178, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod = (struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod)) __PYX_ERR(2, 178, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_ModuleElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "ModuleElement", sizeof(struct __pyx_obj_4sage_9structure_7element_ModuleElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_ModuleElement) __PYX_ERR(2, 181, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_ModuleElement = (struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_ModuleElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_ModuleElement)) __PYX_ERR(2, 181, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_RingElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "RingElement", sizeof(struct __pyx_obj_4sage_9structure_7element_RingElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_RingElement) __PYX_ERR(2, 183, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_RingElement = (struct __pyx_vtabstruct_4sage_9structure_7element_RingElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_RingElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_RingElement)) __PYX_ERR(2, 183, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_ModuleElementWithMutability = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "ModuleElementWithMutability", sizeof(struct __pyx_obj_4sage_9structure_7element_ModuleElementWithMutability), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_ModuleElementWithMutability) __PYX_ERR(2, 195, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_ModuleElementWithMutability = (struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElementWithMutability*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_ModuleElementWithMutability->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_ModuleElementWithMutability)) __PYX_ERR(2, 195, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_MonoidElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "MonoidElement", sizeof(struct __pyx_obj_4sage_9structure_7element_MonoidElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_MonoidElement) __PYX_ERR(2, 200, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_MonoidElement = (struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_MonoidElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_MonoidElement)) __PYX_ERR(2, 200, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "MultiplicativeGroupElement", sizeof(struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement) __PYX_ERR(2, 203, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement = (struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement)) __PYX_ERR(2, 203, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_AdditiveGroupElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "AdditiveGroupElement", sizeof(struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement) __PYX_ERR(2, 206, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement = (struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement)) __PYX_ERR(2, 206, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_CommutativeRingElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "CommutativeRingElement", sizeof(struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_CommutativeRingElement) __PYX_ERR(2, 214, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement = (struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_CommutativeRingElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement)) __PYX_ERR(2, 214, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_IntegralDomainElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "IntegralDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_IntegralDomainElement) __PYX_ERR(2, 217, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_IntegralDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement)) __PYX_ERR(2, 217, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_DedekindDomainElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "DedekindDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_DedekindDomainElement) __PYX_ERR(2, 220, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_DedekindDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement)) __PYX_ERR(2, 220, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "PrincipalIdealDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement) __PYX_ERR(2, 223, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement)) __PYX_ERR(2, 223, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_EuclideanDomainElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "EuclideanDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement) __PYX_ERR(2, 226, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement)) __PYX_ERR(2, 226, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_FieldElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "FieldElement", sizeof(struct __pyx_obj_4sage_9structure_7element_FieldElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_FieldElement) __PYX_ERR(2, 230, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_FieldElement = (struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_FieldElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_FieldElement)) __PYX_ERR(2, 230, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_AlgebraElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "AlgebraElement", sizeof(struct __pyx_obj_4sage_9structure_7element_AlgebraElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_AlgebraElement) __PYX_ERR(2, 233, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_AlgebraElement = (struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_AlgebraElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_AlgebraElement)) __PYX_ERR(2, 233, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "CommutativeAlgebraElement", sizeof(struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement) __PYX_ERR(2, 236, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement = (struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement)) __PYX_ERR(2, 236, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_InfinityElement = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "InfinityElement", sizeof(struct __pyx_obj_4sage_9structure_7element_InfinityElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_InfinityElement) __PYX_ERR(2, 239, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_InfinityElement = (struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_InfinityElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_InfinityElement)) __PYX_ERR(2, 239, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_Vector = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "Vector", sizeof(struct __pyx_obj_4sage_9structure_7element_Vector), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_Vector) __PYX_ERR(2, 243, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_Vector = (struct __pyx_vtabstruct_4sage_9structure_7element_Vector*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Vector->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Vector)) __PYX_ERR(2, 243, __pyx_L1_error)
  __pyx_ptype_4sage_9structure_7element_Matrix = __Pyx_ImportType(__pyx_t_1, "sage.structure.element", "Matrix", sizeof(struct __pyx_obj_4sage_9structure_7element_Matrix), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_9structure_7element_Matrix) __PYX_ERR(2, 258, __pyx_L1_error)
  __pyx_vtabptr_4sage_9structure_7element_Matrix = (struct __pyx_vtabstruct_4sage_9structure_7element_Matrix*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Matrix->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Matrix)) __PYX_ERR(2, 258, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.rings.complex_mpc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_5rings_11complex_mpc_MPComplexNumber = __Pyx_ImportType(__pyx_t_1, "sage.rings.complex_mpc", "MPComplexNumber", sizeof(struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_11complex_mpc_MPComplexNumber) __PYX_ERR(14, 6, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_11complex_mpc_MPComplexNumber = (struct __pyx_vtabstruct_4sage_5rings_11complex_mpc_MPComplexNumber*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_11complex_mpc_MPComplexNumber->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_11complex_mpc_MPComplexNumber)) __PYX_ERR(14, 6, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_11complex_mpc_MPComplexField_class = __Pyx_ImportType(__pyx_t_1, "sage.rings.complex_mpc", "MPComplexField_class", sizeof(struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexField_class), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_11complex_mpc_MPComplexField_class) __PYX_ERR(14, 13, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_11complex_mpc_MPComplexField_class = (struct __pyx_vtabstruct_4sage_5rings_11complex_mpc_MPComplexField_class*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_11complex_mpc_MPComplexField_class->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_11complex_mpc_MPComplexField_class)) __PYX_ERR(14, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.rings.real_mpfr"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_5rings_9real_mpfr_RealNumber = __Pyx_ImportType(__pyx_t_1, "sage.rings.real_mpfr", "RealNumber", sizeof(struct __pyx_obj_4sage_5rings_9real_mpfr_RealNumber), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_9real_mpfr_RealNumber) __PYX_ERR(3, 8, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_9real_mpfr_RealNumber = (struct __pyx_vtabstruct_4sage_5rings_9real_mpfr_RealNumber*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_9real_mpfr_RealNumber->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_9real_mpfr_RealNumber)) __PYX_ERR(3, 8, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_9real_mpfr_RealField_class = __Pyx_ImportType(__pyx_t_1, "sage.rings.real_mpfr", "RealField_class", sizeof(struct __pyx_obj_4sage_5rings_9real_mpfr_RealField_class), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_9real_mpfr_RealField_class) __PYX_ERR(3, 10, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_9real_mpfr_RealField_class = (struct __pyx_vtabstruct_4sage_5rings_9real_mpfr_RealField_class*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_9real_mpfr_RealField_class->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_9real_mpfr_RealField_class)) __PYX_ERR(3, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("hilbert_modgroup.upper_half_plane"); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class = __Pyx_ImportType(__pyx_t_1, "hilbert_modgroup.upper_half_plane", "ComplexPlaneProductElement__class", sizeof(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class) __PYX_ERR(15, 4, __pyx_L1_error)
  __pyx_vtabptr_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class = (struct __pyx_vtabstruct_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class*)__Pyx_GetVtable(__pyx_ptype_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class->tp_dict); if (unlikely(!__pyx_vtabptr_16hilbert_modgroup_16upper_half_plane_ComplexPlaneProductElement__class)) __PYX_ERR(15, 4, __pyx_L1_error)
  __pyx_ptype_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class = __Pyx_ImportType(__pyx_t_1, "hilbert_modgroup.upper_half_plane", "UpperHalfPlaneProductElement__class", sizeof(struct __pyx_obj_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class) __PYX_ERR(15, 49, __pyx_L1_error)
  __pyx_vtabptr_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class = (struct __pyx_vtabstruct_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class*)__Pyx_GetVtable(__pyx_ptype_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class->tp_dict); if (unlikely(!__pyx_vtabptr_16hilbert_modgroup_16upper_half_plane_UpperHalfPlaneProductElement__class)) __PYX_ERR(15, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.categories.map"); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_10categories_3map_Map = __Pyx_ImportType(__pyx_t_1, "sage.categories.map", "Map", sizeof(struct __pyx_obj_4sage_10categories_3map_Map), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_10categories_3map_Map) __PYX_ERR(16, 4, __pyx_L1_error)
  __pyx_vtabptr_4sage_10categories_3map_Map = (struct __pyx_vtabstruct_4sage_10categories_3map_Map*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_Map->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_Map)) __PYX_ERR(16, 4, __pyx_L1_error)
  __pyx_ptype_4sage_10categories_3map_Section = __Pyx_ImportType(__pyx_t_1, "sage.categories.map", "Section", sizeof(struct __pyx_obj_4sage_10categories_3map_Section), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_10categories_3map_Section) __PYX_ERR(16, 28, __pyx_L1_error)
  __pyx_vtabptr_4sage_10categories_3map_Section = (struct __pyx_vtabstruct_4sage_10categories_3map_Section*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_Section->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_Section)) __PYX_ERR(16, 28, __pyx_L1_error)
  __pyx_ptype_4sage_10categories_3map_FormalCompositeMap = __Pyx_ImportType(__pyx_t_1, "sage.categories.map", "FormalCompositeMap", sizeof(struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_10categories_3map_FormalCompositeMap) __PYX_ERR(16, 31, __pyx_L1_error)
  __pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap = (struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_FormalCompositeMap->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap)) __PYX_ERR(16, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.categories.morphism"); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_10categories_8morphism_Morphism = __Pyx_ImportType(__pyx_t_1, "sage.categories.morphism", "Morphism", sizeof(struct __pyx_obj_4sage_10categories_8morphism_Morphism), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_10categories_8morphism_Morphism) __PYX_ERR(17, 5, __pyx_L1_error)
  __pyx_vtabptr_4sage_10categories_8morphism_Morphism = (struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_8morphism_Morphism->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_8morphism_Morphism)) __PYX_ERR(17, 5, __pyx_L1_error)
  __pyx_ptype_4sage_10categories_8morphism_SetMorphism = __Pyx_ImportType(__pyx_t_1, "sage.categories.morphism", "SetMorphism", sizeof(struct __pyx_obj_4sage_10categories_8morphism_SetMorphism), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_10categories_8morphism_SetMorphism) __PYX_ERR(17, 8, __pyx_L1_error)
  __pyx_vtabptr_4sage_10categories_8morphism_SetMorphism = (struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_8morphism_SetMorphism->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism)) __PYX_ERR(17, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.rings.integer"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_5rings_7integer_Integer = __Pyx_ImportType(__pyx_t_1, "sage.rings.integer", "Integer", sizeof(struct __pyx_obj_4sage_5rings_7integer_Integer), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_7integer_Integer) __PYX_ERR(4, 7, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_7integer_Integer = (struct __pyx_vtabstruct_4sage_5rings_7integer_Integer*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_7integer_Integer->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_7integer_Integer)) __PYX_ERR(4, 7, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_7integer_int_to_Z = __Pyx_ImportType(__pyx_t_1, "sage.rings.integer", "int_to_Z", sizeof(struct __pyx_obj_4sage_5rings_7integer_int_to_Z), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_7integer_int_to_Z) __PYX_ERR(4, 45, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_7integer_int_to_Z = (struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_7integer_int_to_Z->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_7integer_int_to_Z)) __PYX_ERR(4, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.misc.binary_tree"); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_4misc_11binary_tree_BinaryTree = __Pyx_ImportType(__pyx_t_1, "sage.misc.binary_tree", "BinaryTree", sizeof(struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_4misc_11binary_tree_BinaryTree) __PYX_ERR(18, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.rings.polynomial.polynomial_compiled"); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "generic_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd) __PYX_ERR(19, 5, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd)) __PYX_ERR(19, 5, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "CompiledPolynomialFunction", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction) __PYX_ERR(19, 7, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction)) __PYX_ERR(19, 7, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "dummy_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd) __PYX_ERR(19, 24, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd)) __PYX_ERR(19, 24, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "var_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_var_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd) __PYX_ERR(19, 28, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_var_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_var_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_var_pd)) __PYX_ERR(19, 28, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "univar_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd) __PYX_ERR(19, 31, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd)) __PYX_ERR(19, 31, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "coeff_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd) __PYX_ERR(19, 34, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd)) __PYX_ERR(19, 34, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "unary_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd) __PYX_ERR(19, 38, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd)) __PYX_ERR(19, 38, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "sqr_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd) __PYX_ERR(19, 41, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd)) __PYX_ERR(19, 41, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "pow_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd) __PYX_ERR(19, 44, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd)) __PYX_ERR(19, 44, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "binary_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd) __PYX_ERR(19, 48, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd)) __PYX_ERR(19, 48, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "add_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_add_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd) __PYX_ERR(19, 51, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_add_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_add_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_add_pd)) __PYX_ERR(19, 51, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "mul_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd) __PYX_ERR(19, 54, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd)) __PYX_ERR(19, 54, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_compiled", "abc_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd) __PYX_ERR(19, 57, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd)) __PYX_ERR(19, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.rings.polynomial.polynomial_element"); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_element", "Polynomial", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial) __PYX_ERR(20, 8, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial)) __PYX_ERR(20, 8, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_element", "Polynomial_generic_dense", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense) __PYX_ERR(20, 49, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense)) __PYX_ERR(20, 49, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact = __Pyx_ImportType(__pyx_t_1, "sage.rings.polynomial.polynomial_element", "Polynomial_generic_dense_inexact", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact) __PYX_ERR(20, 55, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact)) __PYX_ERR(20, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.libs.ntl.ntl_ZZX"); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX = __Pyx_ImportType(__pyx_t_1, "sage.libs.ntl.ntl_ZZX", "ntl_ZZX", sizeof(struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX) __PYX_ERR(21, 3, __pyx_L1_error)
  __pyx_vtabptr_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX = (struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX*)__Pyx_GetVtable(__pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX)) __PYX_ERR(21, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.libs.ntl.ntl_ZZ"); if (unlikely(!__pyx_t_1)) __PYX_ERR(22, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ = __Pyx_ImportType(__pyx_t_1, "sage.libs.ntl.ntl_ZZ", "ntl_ZZ", sizeof(struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ) __PYX_ERR(22, 3, __pyx_L1_error)
  __pyx_vtabptr_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ = (struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ*)__Pyx_GetVtable(__pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ)) __PYX_ERR(22, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("sage.rings.number_field.number_field_element"); if (unlikely(!__pyx_t_1)) __PYX_ERR(23, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement = __Pyx_ImportType(__pyx_t_1, "sage.rings.number_field.number_field_element", "NumberFieldElement", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement) __PYX_ERR(23, 11, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement)) __PYX_ERR(23, 11, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute = __Pyx_ImportType(__pyx_t_1, "sage.rings.number_field.number_field_element", "NumberFieldElement_absolute", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute) __PYX_ERR(23, 43, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute)) __PYX_ERR(23, 43, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative = __Pyx_ImportType(__pyx_t_1, "sage.rings.number_field.number_field_element", "NumberFieldElement_relative", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative) __PYX_ERR(23, 46, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative)) __PYX_ERR(23, 46, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute = __Pyx_ImportType(__pyx_t_1, "sage.rings.number_field.number_field_element", "OrderElement_absolute", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute) __PYX_ERR(23, 51, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute)) __PYX_ERR(23, 51, __pyx_L1_error)
  __pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative = __Pyx_ImportType(__pyx_t_1, "sage.rings.number_field.number_field_element", "OrderElement_relative", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_relative), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative) __PYX_ERR(23, 54, __pyx_L1_error)
  __pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_relative = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_relative*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_relative)) __PYX_ERR(23, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initpullback_cython(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initpullback_cython(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_pullback_cython(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_pullback_cython(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_pullback_cython(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  __Pyx_TraceDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'pullback_cython' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_pullback_cython(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("pullback_cython", __pyx_methods, __pyx_k_Cython_versions_of_Pullback_alg, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_hilbert_modgroup__pullback_cython) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "hilbert_modgroup.pullback_cython")) {
      if (unlikely(PyDict_SetItemString(modules, "hilbert_modgroup.pullback_cython", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  (void)__Pyx_modinit_type_init_code();
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_pullback_cython(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));

  /* "hilbert_modgroup/pullback_cython.pyx":7
 * Note: These are the algorithms that needs optimizing to make it all faster.
 * """
 * from sage.all import ceil,floor,cartesian_product             # <<<<<<<<<<<<<<
 * from sage.arith.misc import gcd
 * from sage.modular.cusps_nf import NFCusp
 */
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ceil);
  __Pyx_GIVEREF(__pyx_n_s_ceil);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ceil);
  __Pyx_INCREF(__pyx_n_s_floor);
  __Pyx_GIVEREF(__pyx_n_s_floor);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_floor);
  __Pyx_INCREF(__pyx_n_s_cartesian_product);
  __Pyx_GIVEREF(__pyx_n_s_cartesian_product);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_cartesian_product);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sage_all, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ceil); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ceil, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_floor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_floor, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_cartesian_product); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cartesian_product, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":8
 * """
 * from sage.all import ceil,floor,cartesian_product
 * from sage.arith.misc import gcd             # <<<<<<<<<<<<<<
 * from sage.modular.cusps_nf import NFCusp
 * from sage.rings.infinity import Infinity
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_gcd);
  __Pyx_GIVEREF(__pyx_n_s_gcd);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_gcd);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sage_arith_misc, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_gcd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gcd, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":9
 * from sage.all import ceil,floor,cartesian_product
 * from sage.arith.misc import gcd
 * from sage.modular.cusps_nf import NFCusp             # <<<<<<<<<<<<<<
 * from sage.rings.infinity import Infinity
 * from sage.structure.sage_object cimport SageObject
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_NFCusp);
  __Pyx_GIVEREF(__pyx_n_s_NFCusp);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NFCusp);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sage_modular_cusps_nf, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_NFCusp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NFCusp, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":10
 * from sage.arith.misc import gcd
 * from sage.modular.cusps_nf import NFCusp
 * from sage.rings.infinity import Infinity             # <<<<<<<<<<<<<<
 * from sage.structure.sage_object cimport SageObject
 * from hilbert_modgroup.upper_half_plane cimport UpperHalfPlaneProductElement__class
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Infinity);
  __Pyx_GIVEREF(__pyx_n_s_Infinity);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Infinity);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sage_rings_infinity, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Infinity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Infinity, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":15
 * # from sage.rings.number_field.number_field_ideal import NumberFieldIdeal
 * from sage.rings.number_field.number_field_element cimport NumberFieldElement
 * from sage.rings.number_field.number_field_element import is_NumberFieldElement             # <<<<<<<<<<<<<<
 * from sage.matrix.constructor import identity_matrix
 * from sage.matrix.all import Matrix
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_is_NumberFieldElement);
  __Pyx_GIVEREF(__pyx_n_s_is_NumberFieldElement);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_is_NumberFieldElement);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sage_rings_number_field_number_f, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_NumberFieldElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_NumberFieldElement, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":16
 * from sage.rings.number_field.number_field_element cimport NumberFieldElement
 * from sage.rings.number_field.number_field_element import is_NumberFieldElement
 * from sage.matrix.constructor import identity_matrix             # <<<<<<<<<<<<<<
 * from sage.matrix.all import Matrix
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_identity_matrix);
  __Pyx_GIVEREF(__pyx_n_s_identity_matrix);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_identity_matrix);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sage_matrix_constructor, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_identity_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_identity_matrix, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":17
 * from sage.rings.number_field.number_field_element import is_NumberFieldElement
 * from sage.matrix.constructor import identity_matrix
 * from sage.matrix.all import Matrix             # <<<<<<<<<<<<<<
 * 
 * cpdef integral_coordinates_in_box(bounds):
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Matrix);
  __Pyx_GIVEREF(__pyx_n_s_Matrix);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Matrix);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sage_matrix_all, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Matrix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Matrix, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "hilbert_modgroup/pullback_cython.pyx":1
 * #cython: profile=True             # <<<<<<<<<<<<<<
 * """
 * Cython versions of Pullback algorithms.
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "sage/rings/integer.pxd":40
 * cdef Integer smallInteger(long value)
 * 
 * cdef inline Integer _Integer_from_mpz(mpz_t e):             # <<<<<<<<<<<<<<
 *     cdef Integer z = Integer.__new__(Integer)
 *     mpz_set(z.value, e)
 */
  __Pyx_TraceReturn(Py_None, 0);

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init hilbert_modgroup.pullback_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init hilbert_modgroup.pullback_cython");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* Profile */
#if CYTHON_PROFILE
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
                                   PyFrameObject** frame,
                                   PyThreadState* tstate,
                                   const char *funcname,
                                   const char *srcfile,
                                   int firstlineno) {
    PyObject *type, *value, *traceback;
    int retval;
    if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
        if (*code == NULL) {
            *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
            if (*code == NULL) return 0;
        }
        *frame = PyFrame_New(
            tstate,                          /*PyThreadState *tstate*/
            *code,                           /*PyCodeObject *code*/
            __pyx_d,                  /*PyObject *globals*/
            0                                /*PyObject *locals*/
        );
        if (*frame == NULL) return 0;
        if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
            Py_INCREF(Py_None);
            (*frame)->f_trace = Py_None;
        }
#if PY_VERSION_HEX < 0x030400B1
    } else {
        (*frame)->f_tstate = tstate;
#endif
    }
      __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
    retval = 1;
    tstate->tracing++;
    tstate->use_tracing = 0;
    __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
    #if CYTHON_TRACE
    if (tstate->c_tracefunc)
        retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
    if (retval && tstate->c_profilefunc)
    #endif
        retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
    tstate->use_tracing = (tstate->c_profilefunc ||
                           (CYTHON_TRACE && tstate->c_tracefunc));
    tstate->tracing--;
    if (retval) {
        __Pyx_ErrRestoreInState(tstate, type, value, traceback);
        return tstate->use_tracing && retval;
    } else {
        Py_XDECREF(type);
        Py_XDECREF(value);
        Py_XDECREF(traceback);
        return -1;
    }
}
static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
    PyCodeObject *py_code = 0;
#if PY_MAJOR_VERSION >= 3
    py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
    if (likely(py_code)) {
        py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
    }
#else
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    py_funcname = PyString_FromString(funcname);
    if (unlikely(!py_funcname)) goto bad;
    py_srcfile = PyString_FromString(srcfile);
    if (unlikely(!py_srcfile)) goto bad;
    py_code = PyCode_New(
        0,
        0,
        0,
        CO_OPTIMIZED | CO_NEWLOCALS,
        __pyx_empty_bytes,     /*PyObject *code,*/
        __pyx_empty_tuple,     /*PyObject *consts,*/
        __pyx_empty_tuple,     /*PyObject *names,*/
        __pyx_empty_tuple,     /*PyObject *varnames,*/
        __pyx_empty_tuple,     /*PyObject *freevars,*/
        __pyx_empty_tuple,     /*PyObject *cellvars,*/
        py_srcfile,       /*PyObject *filename,*/
        py_funcname,      /*PyObject *name,*/
        firstlineno,
        __pyx_empty_bytes      /*PyObject *lnotab*/
    );
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
#endif
    return py_code;
}
#endif

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* py_abs */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        const long a = intval;
        long x;
        long b = PyInt_AS_LONG(op2);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
#endif
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            b = likely(size) ? digits[0] : 0;
            if (size == -1) b = -b;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op2)) {
        const long a = intval;
        double b = PyFloat_AS_DOUBLE(op2);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
            if (8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53))) {
                return PyFloat_FromDouble((double)a / (double)b);
            }
            return PyInt_Type.tp_as_number->nb_true_divide(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            }
        }
                __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
                if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                        || __Pyx_sst_abs(size) <= 52 / PyLong_SHIFT) {
                    return PyFloat_FromDouble((double)a / (double)b);
                }
                return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            return PyLong_FromLong(x);
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            if (unlikely(zerodivision_check && b == 0)) {
                PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");
                return NULL;
            }
            PyFPE_START_PROTECT("divide", return NULL)
            result = ((double)a) / (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
#endif

/* PyNumberPow2 */
static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject *none, int inplace) {
#if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t shiftby;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(exp))) {
        shiftby = PyInt_AS_LONG(exp);
    } else
#endif
    if (likely(PyLong_CheckExact(exp))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const Py_ssize_t size = Py_SIZE(exp);
        if (likely(size == 1)) {
            shiftby = ((PyLongObject*)exp)->ob_digit[0];
        } else if (size == 0) {
            return PyInt_FromLong(1L);
        } else if (unlikely(size < 0)) {
            goto fallback;
        } else {
            shiftby = PyLong_AsSsize_t(exp);
        }
        #else
        shiftby = PyLong_AsSsize_t(exp);
        #endif
    } else {
        goto fallback;
    }
    if (likely(shiftby >= 0)) {
        if ((size_t)shiftby <= sizeof(long) * 8 - 2) {
            long value = 1L << shiftby;
            return PyInt_FromLong(value);
#ifdef HAVE_LONG_LONG
        } else if ((size_t)shiftby <= sizeof(unsigned PY_LONG_LONG) * 8 - 1) {
            unsigned PY_LONG_LONG value = ((unsigned PY_LONG_LONG)1) << shiftby;
            return PyLong_FromUnsignedLongLong(value);
#endif
        } else {
            PyObject *result, *one = PyInt_FromLong(1L);
            if (unlikely(!one)) return NULL;
            result = PyNumber_Lshift(one, exp);
            Py_DECREF(one);
            return result;
        }
    } else if (shiftby == -1 && PyErr_Occurred()) {
        PyErr_Clear();
    }
fallback:
#endif
    return (inplace ? PyNumber_InPlacePower : PyNumber_Power)(two, exp, none);
}

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_FALSE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_TRUE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_TRUE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_NE));
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* InitStrings */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return __Pyx_PyIndex_AsSsize_t(o);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
